diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts index e2677039b0f7..c393254f507a 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts @@ -402,6 +402,14 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration { test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/, parser: { system: true }, }, + { + test: /[\/\\]hot[\/\\]emitter.js$/, + parser: { node: { events: true } }, + }, + { + test: /[\/\\]webpack-dev-server[\/\\]client[\/\\]utils[\/\\]createSocketUrl.js$/, + parser: { node: { querystring: true } }, + }, { test: /\.js$/, ...buildOptimizerUseRule, diff --git a/packages/angular_devkit/build_angular/src/dev-server/index.ts b/packages/angular_devkit/build_angular/src/dev-server/index.ts index ec61f44aa73d..cbb7f4297dca 100644 --- a/packages/angular_devkit/build_angular/src/dev-server/index.ts +++ b/packages/angular_devkit/build_angular/src/dev-server/index.ts @@ -407,6 +407,20 @@ function _addLiveReload( webpackConfig.plugins = []; } + // Enable the internal node plugins but no individual shims + // This is needed to allow module specific rules to include node shims + // Only needed in dev server mode to support live reload capabilities in all package managers + if (webpackConfig.node === false) { + webpackConfig.node = { + global: false, + process: false, + __filename: false, + __dirname: false, + Buffer: false, + setImmediate: false, + }; + } + // This allows for live reload of page when changes are made to repo. // https://webpack.js.org/configuration/dev-server/#devserver-inline let webpackDevServerPath;