I have a webpack configuration where when a package is used more than 3 times, it is move to common
package.
I want to add an exception for one package which i don't want in common
but is ued more than 3 times, how can i do that ?
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: `${configuration.webpack.filenameTemplate}.js`,
minChunks: 3,
}),
Thanks in advance !
After some research, using regexp you can do a pass on specific module by naming them like this :
new webpack.optimize.CommonsChunkPlugin({
name: 'specific package',
filename: `${configuration.webpack.filenameTemplate}.js`,
minChunks: ({ context }) => context && hasPathIn(/(\/|\\)node_modules(\/|\\)theNameOfYourPacakge(\/|\\), context),
}),