-
-
Notifications
You must be signed in to change notification settings - Fork 34k
module: allow subpath imports that start with #/
#60864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
|
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 |
#/#/
|
CI is clean. Added a change entry to the docs for subpath imports to track version support for this change. |
d3b6ceb to
9f4d8ec
Compare
GeoffreyBooth
left a comment
There was a problem hiding this 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?
|
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:
|
|
Landed in e8c9c43 |
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>
This aligns with Node.js PR nodejs/node#60864, which allows defining symmetric `exports` and `imports` fields in package.json: { "exports": { "./*": "./src/*" }, "imports": { "#/*": "./src/*" } }
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