2

我试图在我的电子反应应用程序上运行一个剧作家脚本,但是当它到达剧作家代码时我收到了这个错误。

Module parse failed: Unexpected character '�' (1:2)
src/node_modules/playwright/bin/PrintDeps.exe
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
4

2 回答 2

1

将此 raw-loader 添加到您的 webpack 配置中

yarn add raw-loader -D

{
    test: /\.exe$/i,
    use: 'raw-loader',
},
于 2021-03-02T02:45:08.233 回答
0

您可以在 package.json 的 bundledDependencies 中添加 playwridght

“bundleDependencies”:[“剧作家”],

并将其连接到 webpack.config.js 使用webpack-node-externals

不允许在 bundle.js 中添加 playwright,而是将其保存为外部依赖项

于 2021-10-29T11:25:45.480 回答