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(bundling): add faux-ESM files so "import" in Node works with both named and default exports #18916

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Aug 30, 2023

This PR address an issue with packaging dual formats with Rollup, where using import in Node is causes issues.

  • Since type: module is not specified (intentional), ESM files must have .mjs file extension
  • Default exports in Node are broken due to bundlers writing to exports.default but Node uses exports object as the default export when using CJS in ESM

The updated e2e test has an example in Rollup to ensure dual format works correctly when using ESM in Node.

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #18912

@jaysoo jaysoo requested a review from a team as a code owner August 30, 2023 16:31
@jaysoo jaysoo requested a review from mandarini August 30, 2023 16:31
@vercel
Copy link

vercel bot commented Aug 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 6:14pm

@jaysoo jaysoo force-pushed the fix/rollup-node-import-esm branch from 7cc2f8d to 4d85aac Compare August 30, 2023 16:42
@jaysoo jaysoo force-pushed the fix/rollup-node-import-esm branch 2 times, most recently from fa31e18 to af9055c Compare August 30, 2023 17:32
@jaysoo jaysoo force-pushed the fix/rollup-node-import-esm branch from af9055c to 1760b02 Compare August 30, 2023 18:10
@jaysoo jaysoo merged commit 99c44f9 into nrwl:master Aug 30, 2023
@jaysoo jaysoo deleted the fix/rollup-node-import-esm branch August 30, 2023 19:42
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@nx/rollup package no longer outputs js by default
2 participants