2

I trying to run a playwright script on my electron-react app but I am getting this error when it gets to the playwright code.

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)
Royer Adames
  • 868
  • 9
  • 13

2 Answers2

1

Add this raw-loader to your webpack config

yarn add raw-loader -D

{
    test: /\.exe$/i,
    use: 'raw-loader',
},
Royer Adames
  • 868
  • 9
  • 13
0

You can add playwridght in bundledDependencies in package.json

"bundledDependencies": [ "playwright" ],

and connect it's to webpack.config.js using webpack-node-externals

it's permit not add playwright in bundle.js, but save it as external dependency

HardCoreQual
  • 331
  • 1
  • 3
  • 11