-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(web): add support for Node ESM when used to package SSR-ready library #10349
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
b3f4f65
to
ae5df50
Compare
ae5df50
to
b9f7154
Compare
b9f7154
to
c91fcb9
Compare
c91fcb9
to
fddc3d7
Compare
fddc3d7
to
b81b4aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions and question
b81b4aa
to
b2130b5
Compare
b2130b5
to
c8c9aae
Compare
c8c9aae
to
f7fac7c
Compare
@jaysoo how come the default was changed here without a migration? isn't this a backwards-incompatible change? Removing the commonjs output breaks any tests using Jest since it still uses CommonJS edit: to clarify, I was publishing a package to npm using the output from this executor. When the package is published as ESM-only, it still works in a web application which uses a bundler like webpack, but can not be required in a standard Jest test setup (which doesn't touch the node_modules/ directory and also does not support loading ESM modules except in "experimental" mode) |
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. |
This PR changes the output of libraries built with
@nrwl/web:rollup
so both ESM and CJS will work in Node.Current Behavior
Building with both CJS and ESM results in failed import when trying to import ESM. This error is due to missing
type: "module"
entry inpackage.json
.Expected Behavior
Both ESM and CJS import/require works.
Changes
type: module
field for outputpackage.json
file.exports
field for outputpackage.json
file