From c5b2244a9d979442c2b2193eac2db66ce0eb4358 Mon Sep 17 00:00:00 2001 From: Louis Van de Calseyde Date: Mon, 16 Jan 2017 10:40:09 +0100 Subject: [PATCH] feat(build): use NamedModulesPlugin with HMR Fix #3679 Close #4037 --- package.json | 2 +- .../angular-cli/models/webpack-build-production.ts | 10 ---------- packages/angular-cli/tasks/serve-webpack.ts | 1 + 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 2c286e406d18..94af3722a0ce 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "@types/rimraf": "0.0.25-alpha", "@types/semver": "^5.3.30", "@types/source-map": "^0.5.0", - "@types/webpack": "^1.12.22-alpha", + "@types/webpack": "2.2.0", "chai": "^3.5.0", "conventional-changelog": "^1.1.0", "dtsgenerator": "^0.7.1", diff --git a/packages/angular-cli/models/webpack-build-production.ts b/packages/angular-cli/models/webpack-build-production.ts index ffb198cf9d41..b2b3a28bebbb 100644 --- a/packages/angular-cli/models/webpack-build-production.ts +++ b/packages/angular-cli/models/webpack-build-production.ts @@ -4,16 +4,6 @@ import {CompressionPlugin} from '../lib/webpack/compression-plugin'; const autoprefixer = require('autoprefixer'); const postcssDiscardComments = require('postcss-discard-comments'); -declare module 'webpack' { - export interface LoaderOptionsPlugin {} - export interface LoaderOptionsPluginStatic { - new (optionsObject: any): LoaderOptionsPlugin; - } - interface Webpack { - LoaderOptionsPlugin: LoaderOptionsPluginStatic; - } -} - export const getWebpackProdConfigPartial = function(projectRoot: string, appConfig: any, sourcemap: boolean, diff --git a/packages/angular-cli/tasks/serve-webpack.ts b/packages/angular-cli/tasks/serve-webpack.ts index c8879c6e6517..57b714c6b887 100644 --- a/packages/angular-cli/tasks/serve-webpack.ts +++ b/packages/angular-cli/tasks/serve-webpack.ts @@ -58,6 +58,7 @@ export default Task.extend({ ui.writeLine(' for information on working with HMR for Webpack.'); entryPoints.push('webpack/hot/dev-server'); config.plugins.push(new webpack.HotModuleReplacementPlugin()); + config.plugins.push(new webpack.NamedModulesPlugin()); if (serveTaskOptions.extractCss) { ui.writeLine(oneLine` ${chalk.yellow('NOTICE')} (HMR) does not allow for CSS hot reload when used