Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom webpack configuration #174

Open
TBenedyk opened this issue Mar 8, 2022 · 5 comments
Open

Custom webpack configuration #174

TBenedyk opened this issue Mar 8, 2022 · 5 comments

Comments

@TBenedyk
Copy link

TBenedyk commented Mar 8, 2022

I'm trying to use ejs in my content script but getting an error related to using webpack 5. The solution it says is to add a polyfill to webpack.config.js. But I can't figure out how to do this using extension-cli as the config file is not generated and looking at the gulpfile it seems there's no simple way to add one.

The error output is

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
	- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
	- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "path": false }

So it looks like I just need to have a config file with the following...

module.exports = {
   ...
   resolve: {
    fallback: {
      "fs": false,
      "path": require.resolve("path-browserify")
    }
  },
};

Is there currently a way to do this?

@cwdcwd
Copy link

cwdcwd commented Apr 16, 2022

👍🏻
same here

@TheDarkShaddow
Copy link

Same Problem here.
Would be cool if there were a way to specify a webpack-config-file or something like that.

@atx-barnes
Copy link

I got a similar problem and solved it by installing the missing dependencies which in your case would be path-browserify but now when it builds webpacks are still referencing node_modules outside of the dist directory after running xt-build

@lectrician1
Copy link

I used https://github.com/dutiyesh/chrome-extension-cli and installed https://github.com/Richienb/node-polyfill-webpack-plugin and that fixed the polyfill problem.

@claritytech1008
Copy link

I do see the same problem, unable to have a custom webpack config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants