···11module.exports = function (api) {
22 api.cache(true)
33+ const isTestEnv = process.env.NODE_ENV === 'test'
34 return {
45 presets: [
56 [
67 'babel-preset-expo',
78 {
89 lazyImports: true,
1010+ native: {
1111+ // Disable ESM -> CJS compilation because Metro takes care of it.
1212+ // However, we need it in Jest tests since those run without Metro.
1313+ disableImportExportTransform: !isTestEnv,
1414+ },
915 },
1016 ],
1117 ],
+10
metro.config.js
···8899cfg.transformer.getTransformOptions = async () => ({
1010 transform: {
1111+ experimentalImportSupport: true,
1112 inlineRequires: true,
1313+ nonInlinedRequires: [
1414+ // We can remove this option and rely on the default after
1515+ // https://github.com/facebook/metro/pull/1126 is released.
1616+ 'React',
1717+ 'react',
1818+ 'react/jsx-dev-runtime',
1919+ 'react/jsx-runtime',
2020+ 'react-native',
2121+ ],
1222 },
1323})
1424