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