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

Fix CJS default interop with library bundler #9722

Merged
merged 2 commits into from
May 25, 2024
Merged

Conversation

devongovett
Copy link
Member

When default imports in ESM get compiled to CJS, and referenced in a different bundle (e.g. via the library bundler), we would insert a $parcel$interopDefault call but the referenced bundle might not define the __esModule flag resulting in a crash at runtime.

This PR makes the interopDefault call conditional depending on the symbols in the target bundle.

@devongovett devongovett added this pull request to the merge queue May 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 25, 2024
@devongovett devongovett added this pull request to the merge queue May 25, 2024
Merged via the queue into v2 with commit e825d59 May 25, 2024
15 of 17 checks passed
@devongovett devongovett deleted the fix-cjs-default branch May 25, 2024 17:32
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.

None yet

3 participants