-
Notifications
You must be signed in to change notification settings - Fork 30k
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
module: deprecate trailing slash pattern mappings #40039
Conversation
@nodejs/modules |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1dd5eaa
to
5129ba6
Compare
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
What about core modules? It's a very common pattern to require, eg … or does this only apply to What about wanting to disambiguate |
@ljharb now that we have And yes, disambiguation of |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@guybedford for a core module, yes, i can use
Why are we reducing the usefulness of node because an entirely different specification - one node doesn't even follow - lacks functionality? |
To be clear, you mean being able to do something like that, correct? {
"imports": {
"#fs": "fs/"
}
} And |
Note that So this is just
So this PR only reduces the functionality of a feature landed two days ago with pattern trailers. |
By deprecated, you mean in ESM, or in CJS? Either way, if I have a folder in In CJS, |
We deprecated it specifically for ESM per the folder mappings deprecation PR. Yes, ESM does deprecate the ability to load npm packages with the same names as core modules, but this is completely off topic at this point for this PR - I'd suggest opening another issue to discuss that. |
PR-URL: #40039 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Landed in 7216fb1. |
PR-URL: #40039 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
PR-URL: #40039 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
This PR deprecates the ability for pattern mappings to be able to resolve import specifiers ending in
/
likeimport('pkg/subpath/')
, with a new deprecation warning and message.The primary motivation here is that the import maps specification does not support trailing
/
mappings resolving.For example:
will give the browser console error:
See WICG/import-maps#244 for more background here.
Since we deprecated folder subpaths, there are no common patterns of trailing
/
usage yet. It is only with the introduction of pattern trailers in #39635 that it is now easy to define maps like:to support
import('pkg/asdf/')
resolving topkg/asdf/index.js
for any name.The risk is that users start defining packages like this and then these packages will never be supportable in import maps environments. By deprecating this now we can avoid this outcome.