Repository navigation
Resolution Algorithm Specification fixing #49402
Description
Activity
- addeddocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.
on Aug 29, 2023 Do you want to open a PR instead? A code diff would be easier to follow than a written description of the proposed changes.
Do you want to open a PR instead? A code diff would be easier to follow than a written description of the proposed changes.
I don't discuss a code review, but the algorithm description, which is published under the link above. I used a similar language description which is used there.
I'm working on updating a resolver implementation to support the package.json exports field, and noticed this too. The current line is
Let packageURL be the URL resolution of "node_modules/" concatenated with packageSpecifier, relative to parentURL.This seems to fail when the packageSpecifier is something like
svelte/store, wherestoredoes not exist on disk and is only in the package.jsonexports. Since it doesn't exist, step 11.3 will have it keep looking at parent folders. The current wording seems to be how it worked before there were package.json exports, and it should now use thepackageNameinstead ofpackageSpecifier. The current steps 11.5 and 11.7 handle resolving the rest of the package specifier (the packageSubpath).github-actions commented
on May 28, 2026 on May 28, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on May 28, 2026 Not stale
This was resolved in #57080.
Reacted by zodern
Affected URL(s)
https://nodejs.org/dist/latest-v20.x/docs/api/esm.html#resolution-algorithm-specification
Description of the problem
PACKAGE_RESOLVE function step 11.1 should contains:
Let packageURL be the URL resolution of "node_modules/" concatenated with packageName, relative to parentURL.
The original PACKAGE_EXPORTS_RESOLVE is wrong if subpath is "./xyz" and the keys of exports are not starting with "." (conditions) the step 4 is executed. The suggestion how PACKAGE_EXPORTS_RESOLVE should be implemented.
PACKAGE_EXPORTS_RESOLVE(packageURL, subpath, exports, conditions)
1. Let mainExport be exports["."].
1. Let mainExport be exports.
1. Let resolved be the result of PACKAGE_TARGET_RESOLVE(packageURL, mainExport, null, false, conditions).
1. Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE(subpath, exports, packageURL, false, conditions).