Following the webpack 4.x documentation, we can ignore plugins with IgnorePlugin() method, but the following example only ignore one module (moment/locales)
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/
});
If i want to ignore another module (ex : react-tooltip/dist/index.es.js
),
is there any way to implement another module to ignore, by passing an array with resourceRegExp or contextRegExp for example ?
I tried that :
new webpack.IgnorePlugin(/^\.\/index\.es\.js$/, /react-tooltip\/dist$/),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
But the file seems to be always present in the bundle
You could try matching multiple modules in your regex
This would match
locale
andindex.es.js
within bothmoment
andreact-tooltip/dist
, which isn't exactly the desired solution but may be good enough.