Skip to content

Commit

Permalink
fix: 解决 webpackHotUpdate is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
imsunhao committed Aug 22, 2019
1 parent b7e67d9 commit 40311e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/config/webpack.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -27,6 +29,7 @@ export async function getClientConfig(options: ConfigOptions.options) {
globalObject: 'this'
},
optimization: {
runtimeChunk: !isProd,
minimizer: [
new OptimizeCSSAssetsPlugin()
],
Expand Down
4 changes: 3 additions & 1 deletion src/utils/compiler.webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)

Expand Down

0 comments on commit 40311e7

Please sign in to comment.