Skip to content

Commit 5882ba5

Browse files
committed
split prod web js bundle to chunks
1 parent a79101d commit 5882ba5

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

configs/webpack.config.web.prod.babel.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ export default merge(commonConfig, {
2525
target: 'web',
2626
entry: ['regenerator-runtime/runtime', './index.tsx'],
2727
output: {
28-
filename: 'js/bundle.[fullhash].min.js',
28+
filename: 'js/bundle.[name].min.js',
2929
path: resolve(__dirname, '../redisinsight/ui/dist'),
3030
publicPath: '/',
31+
chunkFilename: '[id].[chunkhash].js'
3132
},
3233
optimization: {
3334
minimize: true,
@@ -37,6 +38,34 @@ export default merge(commonConfig, {
3738
}),
3839
new CssMinimizerPlugin(),
3940
],
41+
runtimeChunk: 'single',
42+
splitChunks: {
43+
chunks: 'all',
44+
maxInitialRequests: Infinity,
45+
minSize: 0,
46+
cacheGroups: {
47+
reactVendor: {
48+
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
49+
name: "reactVendor"
50+
},
51+
elasticVendor: {
52+
test: /[\\/]node_modules[\\/](@elastic)[\\/]/,
53+
name: "elasticVendor"
54+
},
55+
monacoVendor: {
56+
test: /[\\/]node_modules[\\/](monaco-editor)[\\/]/,
57+
name: "monacoVendor"
58+
},
59+
utilityVendor: {
60+
test: /[\\/]node_modules[\\/](lodash)[\\/]/,
61+
name: "utilityVendor"
62+
},
63+
vendor: {
64+
test: /[\\/]node_modules[\\/](!@elastic)(!monaco-editor)(!lodash)[\\/]/,
65+
name: "vendor"
66+
},
67+
},
68+
},
4069
},
4170
plugins: [
4271
new MiniCssExtractPlugin({

0 commit comments

Comments
 (0)