Skip to content

module: allow subpath imports that start with #/ - #60864

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
hybrist:focused-mendeleev
Dec 4, 2025
Merged

module: allow subpath imports that start with #/#60864
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
hybrist:focused-mendeleev

Conversation

@hybrist

Copy link
Copy Markdown
Contributor

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

nodejs-github-bot commented Nov 26, 2025

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/typescript

@nodejs-github-botnodejs-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

codecovBot commented Nov 26, 2025

Copy link
Copy Markdown

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 linesCoverage Δ
lib/internal/modules/esm/resolve.js96.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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

@hybristhybrist added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 1, 2025
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 1, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@hybristhybrist 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
@hybristhybrist changed the title module: allow internal imports that start with #/module: allow subpath imports that start with #/Dec 1, 2025
@hybrist

Copy link
Copy Markdown
ContributorAuthor

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

@GeoffreyBoothGeoffreyBooth left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
ContributorAuthor

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.

@gurgundaygurgunday added the module Issues and PRs related to the module subsystem. label Dec 2, 2025
@aduh95aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 3, 2025
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 3, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@getify

Copy link
Copy Markdown
Contributor

@hybrist just curious, has this yet been backported to v24 branch?

@Renegade334

Copy link
Copy Markdown
Member

just curious, has this yet been backported to v24 branch?

It doesn't require backporting, but won't land in v24.x until it's been landed on the active branch for a period first.

@jsumners-nr

Copy link
Copy Markdown

@chrisbbreuer please stop.

@ovflowd

ovflowd commented Dec 31, 2025

Copy link
Copy Markdown
Member

@nodejs/moderation is there something we can do to stop this spamming of references from this @chrisbbreuer.

@chrisbbreuer

chrisbbreuer commented Dec 31, 2025

Copy link
Copy Markdown

Thanks for notifying me.

This "chrisbbreuer" will resolve it.

On a different note, we are civilized people @ovflowd. Keep your passive aggressive tone to yourself because this clearly wasn't an intention.

@ovflowd

ovflowd commented Dec 31, 2025

Copy link
Copy Markdown
Member

Thanks for notifying me.

This "chrisbbreuer" will resolve it.

On a different note, we are civilized people @ovflowd. Keep your passive aggressive tone to yourself because this clearly wasn't an intention.

With all due respect, you spammed 200+ comments on this repository. You have no say here and I couldn't care less about your demands. (Don't invade someone's else's home and start demanding things in a passive aggressive tone yourself)

On a different note, I'm not a native English speaker, the "this" preceding your handle was my attempt of not assuming your pronouns.

@nodejsnodejs locked as too heated and limited conversation to collaborators Dec 31, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.esmIssues and PRs related to the ECMAScript Modules implementation.moduleIssues and PRs related to the module subsystem.needs-ciPRs that need a full CI run.semver-minorPRs 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.

14 participants

@hybrist@nodejs-github-bot@Renegade334@Scalahansolo@styfle@getify@jsumners-nr@ovflowd@chrisbbreuer@GeoffreyBooth@guybedford@himself65@gurgunday@aduh95