about summary refs log tree commit diff
path: root/babel.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'babel.config.js')
-rw-r--r--babel.config.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/babel.config.js b/babel.config.js
index 598e2a567..0baec0c3c 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,7 +1,20 @@
 module.exports = function (api) {
   api.cache(true)
+  const isTestEnv = process.env.NODE_ENV === 'test'
   return {
-    presets: ['babel-preset-expo'],
+    presets: [
+      [
+        'babel-preset-expo',
+        {
+          lazyImports: true,
+          native: {
+            // Disable ESM -> CJS compilation because Metro takes care of it.
+            // However, we need it in Jest tests since those run without Metro.
+            disableImportExportTransform: !isTestEnv,
+          },
+        },
+      ],
+    ],
     plugins: [
       [
         'module:react-native-dotenv',
@@ -30,5 +43,10 @@ module.exports = function (api) {
       ],
       'react-native-reanimated/plugin', // NOTE: this plugin MUST be last
     ],
+    env: {
+      production: {
+        plugins: ['transform-remove-console'],
+      },
+    },
   }
 }