Skip to content

Conversation

@hybrist
Copy link
Contributor

@hybrist hybrist commented Nov 26, 2025

It's a common ecosystem pattern to map a source root directory to @/ but it requires special tooling support. This turns #/* into a more realistic alternative for that pattern.

See: #49182

It's a common ecosystem pattern to map a source root directory to
`@/` but it requires special tooling support. This turns `#/*` into
a more realistic alternative for that pattern.
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Nov 26, 2025

Review requested:

  • @nodejs/loaders
  • @nodejs/typescript

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Nov 26, 2025
@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.51%. Comparing base (6706b22) to head (9f4d8ec).
⚠️ Report is 56 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60864      +/-   ##
==========================================
- Coverage   88.54%   88.51%   -0.04%     
==========================================
  Files         703      703              
  Lines      208262   208393     +131     
  Branches    40170    40198      +28     
==========================================
+ Hits       184408   184454      +46     
- Misses      15861    15928      +67     
- Partials     7993     8011      +18     
Files with missing lines Coverage Δ
lib/internal/modules/esm/resolve.js 96.19% <100.00%> (-0.01%) ⬇️

... and 43 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.

@Renegade334
Copy link
Member

From the perspective of adding support for a new module resolution flavour to TS et al, should this either be semver-major or >=v25.x-only?

@hybrist
Copy link
Contributor Author

hybrist commented Nov 27, 2025

From the perspective of adding support for a new module resolution flavour to TS et al, should this either be semver-major or >=v25.x-only?

Since this only turns a previous import error into a non-error case, this seems safe to backport pretty aggressively. From the TS perspective, I would expect it to show up in the bundler mode eventually? If TS doesn't actively allow it in node20 mode etc. that doesn't seem like a huge issue.

@hybrist hybrist added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 1, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 1, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@hybrist hybrist added semver-minor PRs that contain new features and should be released in the next minor version. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Dec 1, 2025
@hybrist hybrist changed the title module: allow internal imports that start with #/ module: allow subpath imports that start with #/ Dec 1, 2025
@hybrist hybrist requested a review from guybedford December 1, 2025 21:24
@hybrist
Copy link
Contributor Author

hybrist commented Dec 1, 2025

CI is clean. Added a change entry to the docs for subpath imports to track version support for this change.

Copy link
Member

@GeoffreyBooth GeoffreyBooth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine, but did we dig up the reason for the exclusion in the first place?

@hybrist
Copy link
Contributor Author

hybrist commented Dec 2, 2025

Short answer: no. I did try to look around a bit but I couldn't really find one. The behavior was introduced in the original PR (#34117) and @guybedford's reason seemed to be caution but not necessarily explicit risks:

I thought it seemed sensible to lock down these base cases, but happy to reconsider.

@gurgunday gurgunday added the module Issues and PRs related to the module subsystem. label Dec 2, 2025
@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 3, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 3, 2025
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@hybrist hybrist added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. commit-queue Add this label to land a pull request using GitHub Actions. labels Dec 4, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 4, 2025
@nodejs-github-bot nodejs-github-bot merged commit e8c9c43 into nodejs:main Dec 4, 2025
74 of 76 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in e8c9c43

@hybrist hybrist deleted the focused-mendeleev branch December 4, 2025 14:01
targos pushed a commit that referenced this pull request Dec 5, 2025
It's a common ecosystem pattern to map a source root directory to
`@/` but it requires special tooling support. This turns `#/*` into
a more realistic alternative for that pattern.

PR-URL: #60864
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Claudio Wunder <cwunder@gnome.org>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
magic-akari added a commit to magic-akari/TypeScript that referenced this pull request Dec 6, 2025
This aligns with Node.js PR nodejs/node#60864, which allows defining
symmetric `exports` and `imports` fields in package.json:

{
  "exports": { "./*": "./src/*" },
  "imports": { "#/*": "./src/*" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. esm Issues and PRs related to the ECMAScript Modules implementation. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants