Skip to content

doc: document subpath-pattern precedence and null blocking in exports#64413

Open
Phantom-d-e-v wants to merge 1 commit into
nodejs:mainfrom
Phantom-d-e-v:doc-44517-exports-subpath-precedence
Open

doc: document subpath-pattern precedence and null blocking in exports#64413
Phantom-d-e-v wants to merge 1 commit into
nodejs:mainfrom
Phantom-d-e-v:doc-44517-exports-subpath-precedence

Conversation

@Phantom-d-e-v

Copy link
Copy Markdown

The exports resolution sorts subpath patterns by specificity (lib/internal/modules/esm/resolve.js patternKeyCompare), so the pattern with the longest matching prefix wins regardless of declaration order. A null target blocks any subpath matching its pattern, regardless of key position. The documentation did not state either rule, so add a short clarification after the existing null example.

Fixes: #44517

The exports resolution sorts subpath patterns by specificity
(lib/internal/modules/esm/resolve.js patternKeyCompare), so the pattern
with the longest matching prefix wins regardless of declaration order.
A null target blocks any subpath matching its pattern, regardless of key
position. The documentation did not state either rule, so add a short
clarification after the existing null example.

Fixes: nodejs#44517
@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 Jul 10, 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.

Explain order/precedence for exports-field subpath patterns

2 participants