-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
- Operating System: Mac OS
- Node Version: v10.11.0
- NPM Version: 6.4.1
- webpack Version: 5
- webpack-dev-server Version: 3.1.10
- This is a bug
- This is a modification request
Code
// webpack.config.js var path = require('path'); module.exports = { //... devServer: { contentBase: path.join(__dirname, 'dist'), compress: true, port: 9000, }, resolve: { alias: { 'url': false, 'events' : false } } };
Expected Behavior
Actual Behavior
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 these module and configure a polyfill for it. If you want to include a polyfill, you need to install 'url'. If you don't want to include a polyfill, you can use an empty module like this: resolve.alias: { "url": false } ERROR in (webpack)/hot/emitter.js 1:19-36 Module not found: Error: Can't resolve 'events' in '/Users/debbieobrien/webpack/node_modules/webpack/hot' 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 these module and configure a polyfill for it. If you want to include a polyfill, you need to install 'events'. If you don't want to include a polyfill, you can use an empty module like this: resolve.alias: { "events": false } @ (webpack)-dev-server/client?http://localhost:9000 226:21-51 ℹ 「wdm」: Failed to compile.
after adding the alias to the webpack.config I get this error
✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.resolve.alias should be one of these: object { <key>: string } | [object { alias?, name?, onlyModule? }] -> Redirect module requests Details: * configuration.resolve.alias['url'] should be a string. -> New request * configuration.resolve.alias['events'] should be a string. -> New request * configuration.resolve.alias should be an array: [object { alias?, name?, onlyModule? }]
For Bugs; How can we reproduce the behavior?
Run the webpack-dev-server in next branch