From 40311e74a5ae59ba2bc923b518c802cf4b38867a Mon Sep 17 00:00:00 2001 From: sunhao Date: Thu, 22 Aug 2019 14:33:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=20webpackHotUpdate=20?= =?UTF-8?q?is=20not=20defined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/webpack.client.config.ts | 3 +++ src/utils/compiler.webpack.ts | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/webpack.client.config.ts b/src/config/webpack.client.config.ts index da7b6ac..8715903 100644 --- a/src/config/webpack.client.config.ts +++ b/src/config/webpack.client.config.ts @@ -11,6 +11,8 @@ import { getClientDllPlugin, getExternals } from 'src/utils/plugins.webpack' export async function getClientConfig(options: ConfigOptions.options) { const client = options.webpack ? options.webpack.client || {} : {} const { externals, alias } = getExternals(options, 'client') + const mode = options.webpack.mode || 'production' + const isProd = mode === 'production' return (merge as any)( getBaseConfig(options), @@ -27,6 +29,7 @@ export async function getClientConfig(options: ConfigOptions.options) { globalObject: 'this' }, optimization: { + runtimeChunk: !isProd, minimizer: [ new OptimizeCSSAssetsPlugin() ], diff --git a/src/utils/compiler.webpack.ts b/src/utils/compiler.webpack.ts index f4d595b..ff6caec 100644 --- a/src/utils/compiler.webpack.ts +++ b/src/utils/compiler.webpack.ts @@ -91,7 +91,9 @@ function devCompiler({ clientConfig.output.filename = '[name].js' clientConfig.plugins.push( - new webpack.HotModuleReplacementPlugin(), + new webpack.HotModuleReplacementPlugin({ + multiStep: true, + }), new webpack.NoEmitOnErrorsPlugin() )