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

[snackager] correct output with package type: module #302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mmomtchev
Copy link

@mmomtchev mmomtchev commented May 25, 2022

Why

Refs: #299
Refs: microsoft/rnx-kit#142

The Metro Babel preset does not produce correct output
for packages containing "type": "module" unless
the disableImportExportTransform option is used to
prevent it from including @babel/plugin-transform-modules-commonjs

fixes #299

How

I disable disableImportExportTransform option if I detect "type": "module"

Test Plan

I included my module in the test suite

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
@mmomtchev mmomtchev requested a review from byCedric as a code owner May 25, 2022 11:29
@byCedric
Copy link
Member

Thanks for the issue report and proposed fix! So far, I can confirm the issue. Now going to confirm if this fixes that, have to do that locally.

@byCedric
Copy link
Member

Awesome, also confirmed your fix is working as intended for your package, so disregard the CI :). I'll try and find other packages with similar type: module settings to check for unintended side effects. Probably this weekend!

@mmomtchev
Copy link
Author

I even wonder if this should not be extended to all packages with module: "*" since this transform can have only negative consequences - but on the other side maybe something that works should not be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The runtime does not package the babel helpers while snackager uses runtime-transform
2 participants