Skip to content

loader: enforce path normalization before lookup#63917

Open
arcanis wants to merge 2 commits into
nodejs:mainfrom
arcanis:mael/packate-maps-win32-normalization
Open

loader: enforce path normalization before lookup#63917
arcanis wants to merge 2 commits into
nodejs:mainfrom
arcanis:mael/packate-maps-win32-normalization

Conversation

@arcanis

@arcanis arcanis commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

It seems that calling createRequire(p) doesn't normalize p when it's an absolute path (see here). This causes package maps to fail on calls such as createRequire(process.cwd() + "/node_modules/foo/index.js") because the forward slashes will remain and mismatch with the internal folder -> package name map (whose keys are normalized).

A fix would be to normalize p within createRequire, but it felt reasonable to make a smaller change to the package map lookup method, since nothing else cared about that before.

@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 Jun 14, 2026
Signed-off-by: Maël Nison <nison.mael@gmail.com>
@arcanis arcanis force-pushed the mael/packate-maps-win32-normalization branch from 25faa5c to 2811e40 Compare June 14, 2026 21:27
@arcanis

arcanis commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

None of the failed tests look relevant to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants