From b07f63177365febd1c535ab1be26641b841f02ee Mon Sep 17 00:00:00 2001 From: Charles Lyding Date: Mon, 27 Mar 2017 09:27:38 -0400 Subject: [PATCH] feat(@angular/cli): always use named webpack modules in dev builds --- packages/@angular/cli/models/webpack-configs/development.ts | 6 +++++- packages/@angular/cli/tasks/eject.ts | 3 +++ packages/@angular/cli/tasks/serve.ts | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/@angular/cli/models/webpack-configs/development.ts b/packages/@angular/cli/models/webpack-configs/development.ts index 37cb362d12eb..dc1eb85a882e 100644 --- a/packages/@angular/cli/models/webpack-configs/development.ts +++ b/packages/@angular/cli/models/webpack-configs/development.ts @@ -1,5 +1,9 @@ +import { NamedModulesPlugin } from 'webpack'; + import { WebpackConfigOptions } from '../webpack-config'; export const getDevConfig = function (_wco: WebpackConfigOptions) { - return {}; + return { + plugins: [new NamedModulesPlugin()] + }; }; diff --git a/packages/@angular/cli/tasks/eject.ts b/packages/@angular/cli/tasks/eject.ts index 4bf7eecc98f7..44081b50c1d4 100644 --- a/packages/@angular/cli/tasks/eject.ts +++ b/packages/@angular/cli/tasks/eject.ts @@ -141,6 +141,9 @@ class JsonWebpackSerializer { case webpack.NoEmitOnErrorsPlugin: this._addImport('webpack', 'NoEmitOnErrorsPlugin'); break; + case webpack.NamedModulesPlugin: + this._addImport('webpack', 'NamedModulesPlugin'); + break; case (webpack).HashedModuleIdsPlugin: this._addImport('webpack', 'HashedModuleIdsPlugin'); break; diff --git a/packages/@angular/cli/tasks/serve.ts b/packages/@angular/cli/tasks/serve.ts index 03b23cb7b78c..c91200a07a6d 100644 --- a/packages/@angular/cli/tasks/serve.ts +++ b/packages/@angular/cli/tasks/serve.ts @@ -75,7 +75,6 @@ export default Task.extend({ ui.writeLine(' for information on working with HMR for Webpack.'); entryPoints.push('webpack/hot/dev-server'); webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); - webpackConfig.plugins.push(new webpack.NamedModulesPlugin()); if (serveTaskOptions.extractCss) { ui.writeLine(oneLine` ${chalk.yellow('NOTICE')} (HMR) does not allow for CSS hot reload when used