最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What does "api.cache(true)" do in Expo's babel.config.js? - Stack Overflow

programmeradmin3浏览0评论

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'],
  };
};

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'],
  };
};
Share Improve this question edited Oct 6, 2023 at 9:35 Henke - Нава́льный П с м 5,7676 gold badges41 silver badges51 bronze badges asked Dec 12, 2018 at 0:50 SlboxSlbox 13.1k16 gold badges64 silver badges131 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 22

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

发布评论

评论列表(0)

  1. 暂无评论