Skip to content

Commit

Permalink
doc: importable node protocol URLs
Browse files Browse the repository at this point in the history
PR-URL: #35434
Reviewed-By: Myles Borins <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jan Krems <[email protected]>
  • Loading branch information
bmeck authored and MylesBorins committed Nov 16, 2020
1 parent c192af6 commit 42c0dfc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,27 @@ There are four types of specifiers:
Bare specifiers, and the bare specifier portion of deep import specifiers, are
strings; but everything else in a specifier is a URL.

Only `file:` and `data:` URLs are supported. A specifier like
`file:`, `node:`, and `data:` URLs are supported. A specifier like
`'https://example.com/app.js'` may be supported by browsers but it is not
supported in Node.js.

Specifiers may not begin with `/` or `//`. These are reserved for potential
future use. The root of the current volume may be referenced via `file:///`.

#### `node:` Imports

<!-- YAML
added: REPLACEME
-->

`node:` URLs are supported as a means to load Node.js builtin modules. This
URL scheme allows for builtin modules to be referenced by valid absolute URL
strings.

```js
import fs from 'node:fs/promises';
```

#### `data:` Imports

<!-- YAML
Expand Down

0 comments on commit 42c0dfc

Please sign in to comment.