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
This commit is contained in:
dan 2023-10-30 21:54:23 +00:00 committed by GitHub
parent 6c11c0b81d
commit 84ee64025f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View file

@ -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,
},
},
],
],