Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metro: Also enable disableImportExportTransform when experimentalImportSupport is #142

Closed
tido64 opened this issue Apr 19, 2021 · 0 comments · Fixed by #1871
Closed

Metro: Also enable disableImportExportTransform when experimentalImportSupport is #142

tido64 opened this issue Apr 19, 2021 · 0 comments · Fixed by #1871
Assignees
Labels
feature: metro This is related to Metro

Comments

@tido64
Copy link
Member

tido64 commented Apr 19, 2021

When enabling experimentalImportSupport in metro.config.js:

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: true,
        inlineRequires: true,
      },
    }),
  },
};

disableImportExportTransform should also be enabled in babel.config.js:

module.exports = {
  presets: [
    [
      "module:metro-react-native-babel-preset",
      { disableImportExportTransform: true },
    ],
  ],
};

When babel.config.js is missing, disableImportExportTransform is set to the value of experimentalImportSupport in metro-react-native-babel-transformer. Since we're recommending folks to use our preset, we need to find a way to keep both in sync somehow.

@tido64 tido64 added the feature: metro This is related to Metro label Jul 8, 2021
mmomtchev added a commit to mmomtchev/snack that referenced this issue May 25, 2022
Refs: expo#299
Refs: microsoft/rnx-kit#142

The Metro Babel preset does not produce correct output
for packages containing "type": "module" unless
the disableImportExportTransform options is used to
prevent it from including @babel/plugin-transform-modules-commonjs
@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature: metro This is related to Metro
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants