I tried:
{
"env": {
"development": {
"option": {
"cacheDirectory": true
}
}
}
}
but it didn't work. I just want to enable the cacheDirectory in development environment for the faster hmr. any ideas? thanks!
cacheDirectory is actually an option of babel-loader, not babel itself, so the babelrc config is not the right place for this option.
You can enable it in the configuration of babel-loader. One way of doing so is by using loader: 'babel-loader?cacheDirectory'.
From the babel-loader docs (emphasis my own):
This loader also supports the following loader-specific option:
cacheDirectory: Defaultfalse. When set, the given directory will be used to cache the results of the loader. Future webpack builds will attempt to read from the cache to avoid needing to run the potentially expensive Babel recompilation process on each run. If the value is blank (loader: 'babel-loader?cacheDirectory') ortrue(loader: babel-loader?cacheDirectory=true) the loader will use the default cache directory innode_modules/.cache/babel-loaderor fallback to the default OS temporary file directory if nonode_modulesfolder could be found in any root directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With