Skip to content

fix(npm): realpath npm bin main module - #35554

Merged
nathanwhit merged 1 commit into
denoland:mainfrom
nathanwhit:codex/npm-bin-realpath
Jun 29, 2026
Merged

nathanwhit merged 1 commit into
denoland:mainfrom
nathanwhit:codex/npm-bin-realpath

Conversation

@nathanwhit

Copy link
Copy Markdown
Member

Closes #35551.

This fixes a 2.9.0 regression where a symlinked node_modules/.bin entry was kept as the main module URL when a project package.json caused the path to be treated as npm package space. Relative imports in the bin then resolved from node_modules/.bin instead of the real package target.

The npm main-module import-map bypass added for #23736 is still preserved, but file URLs in that path are canonicalized before being returned. That restores the realpath behavior for symlinked bin entries without applying the import map to package-internal main modules.

Validation:

  • cargo build --bin deno
  • ./x test-spec run_bin_symlink_realpath_package_json
  • ./x test-spec run_bin_with_root_import_map
  • ./tools/lint.js

@nathanwhit
nathanwhit marked this pull request as ready for review June 29, 2026 17:25
@nathanwhit
nathanwhit merged commit c5d5a1a into denoland:main Jun 29, 2026
172 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression (2.9.0): symlinked node_modules/.bin entry not realpath'd when a package.json is present

1 participant