File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -80,15 +80,27 @@ isBuiltin('fs'); // true
8080isBuiltin (' wss' ); // false
8181` ` `
8282
83- ### ` module .register ()`
83+ ### ` module .register (specifier[, parentURL[, options]] )`
8484
8585<!-- YAML
86- added: REPLACEME
86+ added: v20.6.0
8787-->
8888
89- In addition to using the ` -- experimental- loader` option in the CLI,
90- loaders can be registered programmatically using the
91- ` module .register ()` method.
89+ * ` specifier` {string} customization hooks to be registered; this should be the
90+ same string that would be passed to ` import ()` , except that if it is relative,
91+ it is resolved relative to ` process .cwd ()`
92+ * ` parentURL` {string} if you want to resolve ` specifier` relative to a
93+ different base than ` process .cwd ()` , such as ` import .meta.url` , you can pass
94+ that URL here
95+ * ` options` {Object}
96+ * ` data` {any} Any arbitrary, cloneable JavaScript value to pass into the
97+ [` initialize` ][] hook
98+ * ` transferList` {Object\[ ]} \[ transferrable objects]\[ ] to be passed into the
99+ ` initialize` hook
100+ * Returns: {any} returns whatever was returned by the ` initialize` hook
101+
102+ Register a module that exports hooks that customize Node.js’ module resolution
103+ and loading behavior.
92104
93105` ` ` mjs
94106import { register } from ' node:module' ;
You can’t perform that action at this time.
0 commit comments