Skip to content

Commit 3406910

Browse files
notroid5danielleadams
authored andcommitted
doc: clarify escaping for ES modules
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]>
1 parent 1f6a9c3 commit 3406910

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/esm.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ typically configured server.
154154

155155
### URLs
156156

157-
ES modules are resolved and cached as URLs. This means that files containing
158-
special characters such as `#` and `?` need to be escaped.
157+
ES modules are resolved and cached as URLs. This means that special characters
158+
must be [percent-encoded][], such as `#` with `%23` and `?` with `%3F`.
159159

160160
`file:`, `node:`, and `data:` URL schemes are supported. A specifier like
161161
`'https://example.com/app.js'` is not supported natively in Node.js unless using
@@ -1457,6 +1457,7 @@ success!
14571457
[cjs-module-lexer]: https://github.com/nodejs/cjs-module-lexer/tree/1.2.2
14581458
[custom https loader]: #https-loader
14591459
[load hook]: #loadurl-context-defaultload
1460+
[percent-encoded]: url.md#percent-encoding-in-urls
14601461
[resolve hook]: #resolvespecifier-context-defaultresolve
14611462
[special scheme]: https://url.spec.whatwg.org/#special-scheme
14621463
[the official standard format]: https://tc39.github.io/ecma262/#sec-modules

0 commit comments

Comments
 (0)