Skip to content

module: normalize package map paths - #66054

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Dansatch:fix-package-map-directory-urls
Sep 25, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
Dansatch:fix-package-map-directory-urls

Conversation

@Dansatch

@Dansatch Dansatch commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Package-map URLs ending with a slash, including ".." and "./", are stored differently from the paths used during lookup. This causes valid dependencies to fail with ERR_PACKAGE_MAP_EXTERNAL_FILE.

This change normalizes package paths when the map is loaded. Tests cover CommonJS, ESM, parent-directory URLs, trailing slashes, and duplicate paths.

The bug was reproduced on Node.js v26.8.2.

Fixes: #66043

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Signed-off-by: dansatch <dansatch98@gmail.com>
@Dansatch
Dansatch force-pushed the fix-package-map-directory-urls branch from e21d359 to 40dc850 Compare September 16, 2026 03:55
@codecov

codecov Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.26%. Comparing base (bd2b98f) to head (40dc850).
⚠️ Report is 191 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66054      +/-   ##
==========================================
+ Coverage   90.25%   90.26%   +0.01%     
==========================================
  Files         789      789              
  Lines      271424   271424              
  Branches    51799    51801       +2     
==========================================
+ Hits       244964   244996      +32     
+ Misses      16931    16913      -18     
+ Partials     9529     9515      -14     
Files with missing lines Coverage Δ
lib/internal/modules/package_map.js 100.00% <100.00%> (ø)

... and 22 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 18, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 18, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Sep 25, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Sep 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 25, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 0551dee into nodejs:main Sep 25, 2026
80 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 0551dee

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 25, 2026
aduh95 pushed a commit that referenced this pull request Sep 27, 2026
Signed-off-by: dansatch <dansatch98@gmail.com>
PR-URL: #66054
Fixes: #66043
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
HoonDongKang pushed a commit to HoonDongKang/node that referenced this pull request Sep 28, 2026
Signed-off-by: dansatch <dansatch98@gmail.com>
PR-URL: nodejs#66054
Fixes: nodejs#66043
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Sep 28, 2026
Signed-off-by: dansatch <dansatch98@gmail.com>
PR-URL: #66054
Fixes: #66043
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package map entry whose url resolves to a directory-form URL never matches its files

7 participants