简体   繁体   English

api.cache(true)在Expo的babel.config.js中做什么?

[英]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.

相关问题 何时使用 babel.config.js 和 .babelrc - When to use babel.config.js and .babelrc Babel.config.js 仅用于开玩笑 - Babel.config.js only for jest babel.config.js 中的环境变量 - environment variables in babel.config.js webpack 忽略.babelrc 和 babel.config.js - webpack ignores .babelrc and babel.config.js babel.config.js 和 vue.config.js 有什么区别,我可以合并这两个文件吗? - what is the difference between babel.config.js and vue.config.js and can i combine the 2 files? 如果从软件包的依赖项安装了cli-plugin-babel,则不会加载babel.config.js - babel.config.js not loaded if cli-plugin-babel is installed from a package's dependencies npx babel 不从 babel.config.js 读取配置 - npx babel not reading configuration from babel.config.js 如何使Gulp在项目的根目录中读取Babel7的babel.config.js? - How to make Gulp read babel.config.js of Babel7 in the root of the project? 如何设置 babel.config.js,因此找不到相对于目录的预设“@babel/env”工作 - 反应 - How to setup babel.config.js, so Couldn't find preset "@babel/env" relative to directory works - react 尝试在 nextjs 应用程序中添加 `babel.config.js` 时出现`Cannot find module '.next\server\pages-manifest.json'` 错误 - Getting `Cannot find module '.next\server\pages-manifest.json'` error when trying to add `babel.config.js` in nextjs app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM