配置 new webpack.optimize.CommonsChunkPlugin({ name: 'vendor' })这个之后,执行npm run build,出现报错.
Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead.
Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead.
2018-03-01
这是我的代码:
config.plugins.push(
new ExtractPlugin('styles.[contentHash:8].css')
)
config.optimization = {
splitChunks: {
cacheGroups: {
commons: {
chunks: 'initial',
minChunks: 2, maxInitialRequests: 5,
minSize: 0
},
vendor: {
test: /node_modules/,
chunks: 'initial',
name: 'vendor',
priority: 10,
enforce: true
}
}
},
runtimeChunk: true
}
举报