I'm splitting my single page app by means of dynamic imports. I want all of them to be bundled within a single extra file other than the main bundle. Which means, I would end up with something like:
- app.e82eb13a2342391fab679.js - main bundle
- 0.c399423423532432c1da433.js - all the code-splitted chunks in a single bundle
In my Webpack 2 configuration, I accomplish it with this config:
plugins: [
new CommonsChunkPlugin({
names: ['app'],
children: true,
async: true,
}),
new LimitChunkCountPlugin({
maxChunks: 3
}),
]
In Webpack 4, I tried limiting the extra chunks to 1 using this config:
optimization: {
splitChunks: {
chunks: 'async',
minSize: 100000,
maxSize: 0,
minChunks: 1,
maxAsyncRequests: 1,
maxInitialRequests: 1,
automaticNameDelimiter: '~',
name: true,
cacheGroups: {
}
}
}
But I still end up with unwanted extra chunks:
2.c99478cc68a70c1da433.js 1.97 MiB 2 [emitted] [big]
3.913a2df562e62d9338e3.js 1.56 MiB 3 [emitted] [big]
4.4acc069c6a8aa5662198.js 48 KiB 4 [emitted]
app.e82eb13a526791fab679.js 1.31 MiB 0 [emitted] [big] app