Skip to content

Commit f025e88

Browse files
committed
Let webpack split chunks
1 parent 4e8df58 commit f025e88

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

webpack.frontend.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,25 @@ module.exports = {
8484
new MiniCssExtractPlugin({ filename: __DEV__ ? '[name].css' : '[name].[contenthash].css' }),
8585
__PROD__ && new ImageminPlugin({ test: /\.(jpe?g|png|gif|svg)$/i }),
8686
__DEV__ && new webpack.HotModuleReplacementPlugin(),
87+
new webpack.HashedModuleIdsPlugin(),
8788
// new BundleAnalyzerPlugin(),
8889
]),
90+
optimization: {
91+
runtimeChunk: 'single',
92+
splitChunks: {
93+
chunks: 'all',
94+
maxInitialRequests: Infinity,
95+
minSize: 128 * 1024,
96+
cacheGroups: {
97+
vendor: {
98+
test: /[\\/]node_modules[\\/]/,
99+
name(module) {
100+
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
101+
return `npm.${packageName.replace('@', '')}`;
102+
},
103+
},
104+
},
105+
},
106+
},
89107
mode: __DEV__ ? 'development' : 'production',
90108
};

0 commit comments

Comments
 (0)