Carter
12/04/2024, 12:32 PMCarter
12/04/2024, 12:32 PMModule not found: Error: Can't resolve 'bufferutil' in '~/project//build/js/node_modules/ws/lib'
Module not found: Error: Can't resolve 'utf-8-validate' in '~/project//build/js/node_modules/ws/lib'
Module not found: Error: Can't resolve 'zlib' in '~/project//build/js/node_modules/ws/lib'
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: { "zlib": require.resolve("browserify-zlib") }'
- install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "zlib": false }
Module not found: Error: Can't resolve 'stream' in '~/project//build/js/node_modules/ws/lib'
Did you mean './stream'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
Aleksei Tirman [JB]
12/04/2024, 1:01 PMCarter
12/04/2024, 1:18 PMconfig.resolve = {
...config.resolve,
fallback: {
"bufferutil": false,
"crypto": false,
"http": false,
"https": false,
"net": false,
"stream": false,
"tls": false,
"url": false,
"utf-8-validate": false,
"zlib": false,
}
};
Although when I do that, I notice that my application is compiled into three different js files instead of a single js output like before . Is that the same bug, or a separate bug?