Skip to content

docs: recommend node/default conditions#63986

Closed
starkmarkus wants to merge 1 commit into
nodejs:mainfrom
starkmarkus:codex/node-dual-package-docs
Closed

docs: recommend node/default conditions#63986
starkmarkus wants to merge 1 commit into
nodejs:mainfrom
starkmarkus:codex/node-dual-package-docs

Conversation

@starkmarkus

Copy link
Copy Markdown

Summary

Clarify the conditional exports docs by recommending node/default for packages that need a Node-specific entry point plus a fallback for other runtimes.

Context

The current docs explain the hazards around "import" and "require", but the dual-package section only pointed at the examples repo. This adds a concrete node/default example directly in the docs.

Fixes #52174

Changes

  • Add a short recommendation near the conditional exports section.
  • Expand the dual CommonJS/ES module packages section with a node/default example.

Testing

Ran:

make lint-md

Result: failed in this sandbox because npm could not reach registry.npmjs.org (ENOTFOUND).

Ran:

git diff --check

Result: passed.

Fixes: nodejs#52174
Signed-off-by: Markus Stark <markusstark@MacBook-Air-von-Markus.local>
@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 Jun 18, 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.

Recommend node/default conditions instead of require/import as a solution to the dual package hazard

2 participants