Skip to content

Commit

Permalink
webpack v4 -> v5 polyfill configuration
Browse files Browse the repository at this point in the history
From the error message that showed before these changes:

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: { "buffer": require.resolve("buffer/") }'
	- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
	resolve.fallback: { "buffer": false }
  • Loading branch information
victorlin committed Sep 8, 2022
1 parent 03356b8 commit 89ff971
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.16.3",
"buffer": "^6.0.3",
"bundlesize": "^0.18.1",
"chai": "^4.1.2",
"chai-http": "^4.0.0",
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ const generateConfig = ({extensionPath, devMode=false, customOutputPath, analyze
resolve: {
alias: aliasesToResolve,
fallback: {
buffer: require.resolve("buffer/"),
fs: false
}
},
Expand Down

0 comments on commit 89ff971

Please sign in to comment.