Skip to content

doc: add guidance on using node/default conditions for dual packages#62744

Open
Jah-yee wants to merge 1 commit intonodejs:mainfrom
Jah-yee:doc/add-node-default-conditions
Open

doc: add guidance on using node/default conditions for dual packages#62744
Jah-yee wants to merge 1 commit intonodejs:mainfrom
Jah-yee:doc/add-node-default-conditions

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Apr 14, 2026

Good day,

As an alternative to using "import"/"require" conditions, packages can use
"node"/"default" conditions to avoid the dual package hazard while still
providing ES modules for non-Node.js environments.

This addresses issue #52174.

The documentation now includes an example showing how to use "node": "./index.cjs" with
"default": "./index.mjs" to provide different implementations while avoiding
the dual package hazard in Node.js.

Thank you for your work on this project. I hope this small fix is helpful. Please let me know if there's anything to adjust.

Warmly, RoomWithOutRoof

As an alternative to using "import"/"require" conditions, packages can use
"node"/"default" conditions to avoid the dual package hazard while still
providing ES modules for non-Node.js environments.

This addresses issue nodejs#52174.
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants