I am working on the frontend part of my project using Redux. It was all good then all all of a sudden these errors showed up. I have 23 errors like this.
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 }
I created a webpack.config.js file and did this. But the errors aren't going away. I'm new to this and just trying out new stuff.
module.exports = {
resolve: {
fallback: { url: require.resolve("url/") }
}
}
module.exports = {
resolve: {
fallback: { path: require.resolve("path-browserify") }
}
}
module.exports = {
resolve: {
fallback: { zlib: require.resolve("browserify-zlib") }
}
}
module.exports = {
resolve: {
fallback: { crypto: require.resolve("crypto-browserify") }
}
}
module.exports = {
resolve: {
// fallback: { stream: require.resolve("stream-browserify") }
fallback: { "stream": false }
}
}
module.exports = {
resolve: {
fallback: { "path": false }
}
}
Then i npm install those as well.
CodePudding user response:
You need to put all the configurations under a single module.exports object, like this:
module.exports = {
resolve: {
fallback: {
url: require.resolve("url/"),
path: require.resolve("path-browserify"),
zlib: require.resolve("browserify-zlib")
}
}
}