-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Unsupported character(s) in import module-name #41052
Comments
import specifiers are URLs. you'll need to replace |
Okay, that works but is this documented somewhere? |
Yes. https://nodejs.org/api/esm.html#urls
There is probably room for improvement. For example, it could indicate the type of escaping, as escaping with If you or someone else reading this would like to suggest an improvement, you can click the "Edit On GitHub" link at the top of that page, or you can edit the |
There's probably a discussion to be had about whether this calls for a doc enhancement, a change in the error message, or an actual change in the behavior of the ESM system. (I would imagine that last one seems unlikely to happen, but I'm not deeply engaged in the discussions around that stuff so I could be very wrong.) (Also, those three options are not mutually exclusive.) @nodejs/modules |
Well precisely it doesn't, hence your issue. If all the parts of your path only contains alphanumeric characters, and you are using an OS that accepts So you are trying to specify a relative URL, the problem is that $ new URL('./#user/user0.js', 'file:///local/cwd/')
URL {
hash: "#user/user0.js"
host: ""
hostname: ""
href: "file:///local/cwd/#user/user0.js"
origin: "file://"
password: ""
pathname: "/local/cwd/"
port: ""
protocol: "file:"
search: ""
searchParams: URLSearchParams {}
username: ""
[[Prototype]]: URL
} The same thing would appear if you were using |
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: nodejs#41052 PR-URL: nodejs#41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Version
16.13.0
Platform
Microsoft Windows NT 10.0.19043.0 x64
Subsystem
No response
What steps will reproduce the bug?
server.js
:package.json
:#
(probably not the only unsupported character), e.g.#user
user0.js
:How often does it reproduce? Is there a required condition?
Node.js always throws an unconditional error during the import.
What is the expected behavior?
It should log the string.
What do you see instead?
Additional information
npm -v
: 8.1.0\
the#
does not work#
, it works as expected#
, yet is aware of the rest of the full path...?import module-names
, so I have to assume there is none, which would mean that every character should be supported, especially since it's just a string pointing to a fileEdit: Typo
The text was updated successfully, but these errors were encountered: