I am struggling following the docs on implicit common vendor chunk.
I would like all node_modules
to be in a vendor chunk.
I have one entry point (app
), with several children chunks.
I tried:
new webpack.optimize.CommonsChunkPlugin({
name: 'vendors',
minChunks: module => module.context && module.context.includes('node_modules'),
}),
-> strips all node_modules from the entry chunk (app.chunk.js) but leaves node_modules in the children
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendors',
children: true,
minChunks: module => module.context && module.context.includes('node_modules'),
}),
-> strips node_modules from all children chunks but NOT from app...
Looking for a way to do both (strip node_modules from ALL chunks and put them in vendors.chunk.js).
Thanks in advance,
PS: using https://chrisbateman.github.io/webpack-visualizer/ to analyze the outputs