You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 16, 2020. It is now read-only.
would load the module `x.js` as an ES module with relative resolution support
388
+
(with `node_modules` loading skipped in this example).
389
+
390
+
### Dynamic instantiate hook
391
+
392
+
To create a custom dynamic module that doesn't correspond to one of the
393
+
existing `format` interpretations, the `dynamicInstantiate` hook can be used.
394
+
This hook is called only for modules that return `format:'dynamic'` from
395
+
the `resolve` hook.
396
+
397
+
```js
398
+
exportasyncfunctiondynamicInstantiate(url) {
399
+
return {
400
+
exports: ['customExportName'],
401
+
execute: (exports) => {
402
+
// Get and set functions provided for pre-allocated export names
403
+
exports.customExportName.set('value');
404
+
}
405
+
};
406
+
}
407
+
```
408
+
409
+
With the list of module exports provided upfront, the `execute` function will
410
+
then be called at the exact point of module evaluation order for that module
411
+
in the import tree.
412
+
292
413
[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
0 commit comments