The config for loading all of a project's dependencies from /node_modules
into a chunk called vendors
looks like this:
optimization: {
splitChunks: {
cacheGroups: {
commons: { test: /[\\/]node_modules[\\/]/, name: "vendors", chunks: "all" }
}
}
}
So for your use case, you could modify the RegExp to exclude whatever modules you desire. Of course, the downside is that you have to tangle with regular expressions, and the exact formatting of that particular testing condition is beyond my expertise. I know the documentation on optimization.splitChunks
is still pretty sparse so I hope this at least helps point you in the right direction.