| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7c700eb commit 0c64093
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -174,32 +174,31 @@ The volume root may be referenced via `/`, `//` or `file:///`. Given the | |||
| 174 | 174 | differences between [URL][] and path resolution (such as percent encoding | |
| 175 | 175 | details), it is recommended to use [url.pathToFileURL][] when importing a path. | |
| 176 | 176 | ||
| 177 | - #### `data:` Imports | ||
| 177 | + #### `data:` imports | ||
| 178 | 178 | ||
| 179 | 179 | <!-- YAML | |
| 180 | 180 | added: v12.10.0 | |
| 181 | 181 | --> | |
| 182 | 182 | ||
| 183 | 183 | [`data:` URLs][] are supported for importing with the following MIME types: | |
| 184 | 184 | ||
| 185 | - * `text/javascript` for ES Modules | ||
| 185 | + * `text/javascript` for ES modules | ||
| 186 | 186 | * `application/json` for JSON | |
| 187 | 187 | * `application/wasm` for Wasm | |
| 188 | 188 | ||
| 189 | - `data:` URLs only resolve [_Bare specifiers_][Terminology] for builtin modules | ||
| 190 | - and [_Absolute specifiers_][Terminology]. Resolving | ||
| 191 | - [_Relative specifiers_][Terminology] does not work because `data:` is not a | ||
| 192 | - [special scheme][]. For example, attempting to load `./foo` | ||
| 193 | - from `data:text/javascript,import "./foo";` fails to resolve because there | ||
| 194 | - is no concept of relative resolution for `data:` URLs. An example of a `data:` | ||
| 195 | - URLs being used is: | ||
| 196 | - | ||
| 197 | 189 | ```js | |
| 198 | 190 | import 'data:text/javascript,console.log("hello!");'; | |
| 199 | 191 | import _ from 'data:application/json,"world!"' assert { type: 'json' }; | |
| 200 | 192 | ``` | |
| 201 | 193 | ||
| 202 | - #### `node:` Imports | ||
| 194 | + `data:` URLs only resolve [bare specifiers][Terminology] for builtin modules | ||
| 195 | + and [absolute specifiers][Terminology]. Resolving | ||
| 196 | + [relative specifiers][Terminology] does not work because `data:` is not a | ||
| 197 | + [special scheme][]. For example, attempting to load `./foo` | ||
| 198 | + from `data:text/javascript,import "./foo";` fails to resolve because there | ||
| 199 | + is no concept of relative resolution for `data:` URLs. | ||
| 200 | + | ||
| 201 | + #### `node:` imports | ||
| 203 | 202 | ||
| 204 | 203 | <!-- YAML | |
| 205 | 204 | added: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments