简体   繁体   中英

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. 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. It is possible to optimize the build process performance by caching config function execution result. api.cache(true) does exactly that. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM