18

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'],
  };
};
Slbox
  • 10,957
  • 15
  • 54
  • 106

1 Answers1

20

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

Alex Musayev
  • 635
  • 10
  • 20