diff options
author | Bradley Farias <bradley.meck@gmail.com> | 2020-09-30 23:57:08 +0300 |
---|---|---|
committer | Bradley Farias <bradley.meck@gmail.com> | 2020-10-03 00:02:00 +0300 |
commit | 96a5200a0776d80970713bffde0385932765563f (patch) | |
tree | 03d51a5443e35a22832f020d018d7b0fc68da720 /doc/api/esm.md | |
parent | 919be9196f9f87aac5075a11b2af0b9c9fc3a949 (diff) |
doc: importable node protocol URLs
PR-URL: https://github.com/nodejs/node/pull/35434
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Diffstat (limited to 'doc/api/esm.md')
-rw-r--r-- | doc/api/esm.md | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/api/esm.md b/doc/api/esm.md index aa5a9b5c573..d1ed9241506 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -105,13 +105,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 |