gpt4 book ai didi

babeljs - 在 .babelrc 文件中指定 cacheDirectory

转载 作者:行者123 更新时间:2023-12-04 14:59:39 26 4
gpt4 key购买 nike

我试过了:

{
"env": {
"development": {
"option": {
"cacheDirectory": true
}
}
}
}

但它没有用。我只想在开发环境中启用 cacheDirectory 以获得更快的 hmr。有任何想法吗?谢谢!

最佳答案

cacheDirectory 实际上是 babel-loader 的一个选项,而不是 babel 本身,所以 babelrc 的配置是不是此选项的正确位置。

你可以在babel-loader的配置中开启它。一种方法是使用 loader: 'babel-loader?cacheDirectory'

来自 babel-loader docs (强调我自己的):

This loader also supports the following loader-specific option:

  • cacheDirectory: Default false. 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') or true (loader:
    babel-loader?cacheDirectory=true
    ) the loader will use the default cache directory in node_modules/.cache/babel-loader or fallback to the default OS temporary file directory if no node_modules folder could be found in any root directory.

关于babeljs - 在 .babelrc 文件中指定 cacheDirectory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47936856/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com