Skip to content

Commit

Permalink
doc: clarify escaping for ES modules
Browse files Browse the repository at this point in the history
This should make it clear(er) how to escape special characters like `#`
and `?`.

Ref: #41052

PR-URL: #41074
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
notroid5 authored and danielleadams committed Dec 13, 2021
1 parent 1f6a9c3 commit 3406910
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/esm.md
Expand Up @@ -154,8 +154,8 @@ typically configured server.

### URLs

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

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

0 comments on commit 3406910

Please sign in to comment.