| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cb33487 commit 821951e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -128,10 +128,18 @@ argument to the resolver for easy compatibility workflows. | |||
| 128 | 128 | ||
| 129 | 129 | In addition to returning the resolved file URL value, the resolve hook also | |
| 130 | 130 | returns a `format` property specifying the module format of the resolved | |
| 131 | - module. This can be one of `"esm"`, `"cjs"`, `"json"`, `"builtin"` or | ||
| 132 | - `"addon"`. | ||
| 131 | + module. This can be one of the following: | ||
| 133 | 132 | ||
| 134 | - For example a dummy loader to load JavaScript restricted to browser resolution | ||
| 133 | + | `format` | Description | | ||
| 134 | + | --- | --- | | ||
| 135 | + | `"esm"` | Load a standard JavaScript module | | ||
| 136 | + | `"cjs"` | Load a node-style CommonJS module | | ||
| 137 | + | `"builtin"` | Load a node builtin CommonJS module | | ||
| 138 | + | `"json"` | Load a JSON file | | ||
| 139 | + | `"addon"` | Load a [C++ Addon][addons] | | ||
| 140 | + | `"dynamic"` | Use a [dynamic instantiate hook][] | | ||
| 141 | + | ||
| 142 | + For example, a dummy loader to load JavaScript restricted to browser resolution | ||
| 135 | 143 | rules with only JS file extension and Node builtin modules support could | |
| 136 | 144 | be written: | |
| 137 | 145 | ||
@@ -205,3 +213,5 @@ then be called at the exact point of module evalutation order for that module | |||
| 205 | 213 | in the import tree. | |
| 206 | 214 | ||
| 207 | 215 | [Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md | |
| 216 | + [addons]: addons.html | ||
| 217 | + [dynamic instantiate hook]: #esm_dynamic_instantiate_hook | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments