Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SimpleCacheConfigurator

JS configs are great because they can compute a config on the fly, but the downside there is that it makes caching harder. Babel wants to avoid re-executing the config function every time a file is compiled, because then it would also need to re-execute any plugin and preset functions referenced in that config.

To avoid this, Babel expects users of config functions to tell it how to manage caching within a config file.

see

https://babeljs.io/docs/en/next/config-files#apicache

Hierarchy

  • SimpleCacheConfigurator

Index

Methods

forever

  • forever(): void
  • Permacache the computed config and never call the function again.

    Returns void

invalidate

  • Any time the using callback returns a value other than the one that was expected, the overall config function will be called again and all entries in the cache will be replaced with the result.

    example

    api.cache.invalidate(() => process.env.NODE_ENV)

    Type parameters

    Parameters

    Returns T

never

  • never(): void
  • Do not cache this config, and re-execute the function every time.

    Returns void

using

  • Any time the using callback returns a value other than the one that was expected, the overall config function will be called again and a new entry will be added to the cache.

    example

    api.cache.using(() => process.env.NODE_ENV)

    Type parameters

    Parameters

    Returns T