module.register(specifier[, parentURL][, options])
版本历史
| 版本 | 变更 |
|---|---|
| v18.19.0 | 添加对 WHATWG URL 实例的支持。 |
| v18.19.0 | 新增于: v18.19.0 |
\Stability: 1.1 - Active development
-
specifier<string> | <URL> 需要注册的定制钩子;这应该与传递给import()的字符串相同,但如果它是相对的,则它是相对于parentURL解析的。\
specifier<string> | <URL> Customization hooks to be registered; this should be the same string that would be passed toimport(), except that if it is relative, it is resolved relative toparentURL. -
parentURL<string> | <URL> 如果你想要相对于基本 URL(例如import.meta.url)解析specifier,你可以在此处传递该 URL。默认值:'data:'\
parentURL<string> | <URL> If you want to resolvespecifierrelative to a base URL, such asimport.meta.url, you can pass that URL here. Default:'data:' -
options<Object>-
data<any> 传递到initialize钩子的任何任意的、可克隆的 JavaScript 值。\
data<any> Any arbitrary, cloneable JavaScript value to pass into theinitializehook. -
transferList<Object[]> 可转换对象 要传递到initialize钩子中。\
transferList<Object[]> transferrable objects to be passed into theinitializehook.
-
注册一个导出 钩子 的模块,用于自定义 Node.js 模块解析和加载行为。参见 定制钩子。
\Register a module that exports hooks that customize Node.js module resolution and loading behavior. See Customization hooks.