Permacache the computed config and never call the function again.
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.
Do not cache this config, and re-execute the function every time.
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.
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.
https://babeljs.io/docs/en/next/config-files#apicache