提交 f025e882 编写于 作者: J Jason Park

Let webpack split chunks

上级 4e8df588
......@@ -84,7 +84,25 @@ module.exports = {
new MiniCssExtractPlugin({ filename: __DEV__ ? '[name].css' : '[name].[contenthash].css' }),
__PROD__ && new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }),
__DEV__ && new webpack.HotModuleReplacementPlugin(),
new webpack.HashedModuleIdsPlugin(),
// new BundleAnalyzerPlugin(),
]),
optimization: {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 128 * 1024,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return `npm.${packageName.replace('@', '')}`;
},
},
},
},
},
mode: __DEV__ ? 'development' : 'production',
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册