Skip to content

Commit

Permalink
Let webpack split chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
64json committed Jan 24, 2019
1 parent 4e8df58 commit f025e88
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions webpack.frontend.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

0 comments on commit f025e88

Please sign in to comment.