Answer the question
In order to leave comments, you need to log in
Webpack CommonsChunkPlugin and splitChunks?
On webpack 3, I have this code snippet where CommonsCunkPlugin concatenates more than 2 modules or node_modules into one file
new webpack.optimize.CommonsChunkPlugin({
name: 'commons',
filename: '[name].js',
minChunks: function(modules, quantity) {
return modules.context && (modules.context.includes('node_modules') || quantity >= 2)
}
})
cacheGroups: {
commons: {
name: 'commons',
filename: '[name].js',
test: function(modules) {
return modules.context && modules.context.includes('node_modules')
},
chunks: 'all'
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question