fregante / content-scripts-register-polyfill

WebExtensions: Polyfill for browser.contentScripts.register() for Chrome.
https://npm.im/content-scripts-register-polyfill
MIT License
25 stars 6 forks source link

Webpack issue when trying to build #32

Closed squidis closed 3 years ago

squidis commented 3 years ago

Hi,

I'm getting this error when trying to build with this script installed.

`ERROR in node_modules/webext-polyfill-kinda/index.js 22:34 Module parse failed: Unexpected token (22:34) 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 }
> const chromeP = globalThis.window?.chrome && new NestedProxy(window.chrome);
|
| export default chromeP;`

My guess is webext-polyfill-kinda is exporting an unbuilt file which is causing errors since node_modules isn't transpiled using babel?

fregante commented 3 years ago

The file is fine as is in the browser but you should update webpack because it uses ES2020 syntax.

More info may be here, but the solution is the same: Update webpack