about summary refs log tree commit diff
path: root/babel.config.js
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2023-10-30 21:54:23 +0000
committerGitHub <noreply@github.com>2023-10-30 21:54:23 +0000
commit84ee64025f683ec846827bf98c26a0bf8c54c080 (patch)
tree4f9a7e40639cf716c628f5fef20aafe6dd0e0887 /babel.config.js
parent6c11c0b81de34a486df9c67d8f04d0d2050ce9b3 (diff)
downloadvoidsky-84ee64025f683ec846827bf98c26a0bf8c54c080.tar.zst
Let Metro handle import/export instead of Babel (#1772)
* Let Metro handle import/export instead of Babel

* Keep using Babel for ESM->CJS in tests
Diffstat (limited to 'babel.config.js')
-rw-r--r--babel.config.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/babel.config.js b/babel.config.js
index a38edf1d6..0baec0c3c 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,11 +1,17 @@
 module.exports = function (api) {
   api.cache(true)
+  const isTestEnv = process.env.NODE_ENV === 'test'
   return {
     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,
+          },
         },
       ],
     ],