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