I am using CRA + with rescripts
I want to tree-shake Moment.js locales, exactly the same way as shown in ignorePlugin Webpack docs:
new webpack.IgnorePlugin({
checkResource (resource) {
// do something with resource
return true|false;
}
});
I know I can easily transform webpack config with a rescript:
config => {
const newConig = ...
return newConfig
}
But how can I get hold of the webpack
object to call the IgnorePlugin
method - or achieve the same result?
I am willing to switch from rescripts to an alternative, like react-app-rewired
, if necessary.