[英]What does api.cache(true) do in Expo's babel.config.js?
This line appears in the default Expo babel.config.js
, but I can't find any reference anywhere to what it does. 此行出现在默认的Expo
babel.config.js
,但我在任何地方都找不到它的功能参考。 Is there anyone who knows what this does? 有谁知道这是做什么的吗?
module.exports = function(api) { api.cache(true); return { presets: ['babel-preset-expo'], }; };
By default, Babel will evaluate configuration each time it processes a new file. 默认情况下,Babel每次处理新文件时都会评估配置。 It is possible to optimize the build process performance by caching config function execution result.
通过缓存配置函数执行结果可以优化构建过程的性能。
api.cache(true)
does exactly that. api.cache(true)
正是这样做的。 When the cache is enabled this way, config function will be called only once. 通过这种方式启用缓存后,配置函数将仅被调用一次。
Here is a link for a more detailed explanation of Babel configuration caching: https://babeljs.io/docs/en/config-files#apicache 以下是有关Babel配置缓存的更详细说明的链接: https : //babeljs.io/docs/en/config-files#apicache
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.