fix: add exports to package.json for Node.JS v20.19.0#940
Open
aloisklink wants to merge 1 commit intocypress-io:masterfrom
Open
fix: add exports to package.json for Node.JS v20.19.0#940aloisklink wants to merge 1 commit intocypress-io:masterfrom
exports to package.json for Node.JS v20.19.0#940aloisklink wants to merge 1 commit intocypress-io:masterfrom
Conversation
Add Node.JS export conditions to `package.json`, so that the examples of
things like `import '@cypress/code-coverage/support'` continue to work
in Node.JS v20.19.0.
I believe I've added `package.json` too since it's theoretically
possible somebody did `require("@cypress/code-coverage/package.json")`,
so we should support that too.
See: https://nodejs.org/api/packages.html#exports
|
aloisklink
added a commit
to aloisklink/mermaid
that referenced
this pull request
Mar 25, 2025
Node.JS v20.19.0 breaks `import '@cypress/code-coverage/task'` in the `cypress.config.ts` for some reason (this is probably due to the new `experimental-require-module` feature that is enabled by default in Node.JS v20.19.0). As a work-around, we can change this to `@cypress/code-coverage/task.js`. See: cypress-io/code-coverage#940 See: https://nodejs.org/en/blog/release/v20.19.0
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Node.JS export conditions to
package.json, so that the examples of things likeimport '@cypress/code-coverage/support'continue to work in Node.JS v20.19.0.I've added
package.jsontoo since it's theoretically possible somebody didrequire("@cypress/code-coverage/package.json"), so we should support that too.See: https://nodejs.org/api/packages.html#exports
The bug this fixes
I'm not sure why, but
import "@cypress/code-coverage/task"in acypress.config.tsfile seems to break in Node.JS v20.19.0, despite working before, with:I think this is probably a bug in
ts-node/esm, since it looks like there's a similar issue with@swc-node/register/esm-register: nodejs/node#57536Still, it's worth changing this package so that
import '@cypress/code-coverage/support'works in ESM too!