I need help migrating the following code from webpack 3 to 4.
new webpack.optimize.CommonsChunkPlugin({
minChunks: module => module.context &&
Please note that I corrected the issue by changing this in my webpack.common.js:
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: ['vendor']
})
]
To this:
optimization: {
runtimeChunk: "single", // enable "runtime" chunk
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "vendor",
chunks: "all"
}
}
}
},