module.register(specifier[, parentURL][, options])
¥Stability: 1.2 - Release candidate
-
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>-
parentURL<string> | <URL> 如果你想要相对于基本 URL(例如import.meta.url)解析specifier,你可以在此处传递该 URL。如果parentURL作为第二个参数提供,则忽略此属性。默认值:'data:'¥
parentURL<string> | <URL> If you want to resolvespecifierrelative to a base URL, such asimport.meta.url, you can pass that URL here. This property is ignored if theparentURLis supplied as the second argument. Default:'data:' -
data<any> 传递到initialize钩子的任何任意的、可克隆的 JavaScript 值。¥
data<any> Any arbitrary, cloneable JavaScript value to pass into theinitializehook. -
transferList<Object[]> 可转移对象 要传递到initialize钩子中。¥
transferList<Object[]> transferable 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.
如果与 权限模型 一起使用,此功能需要 --allow-worker。
¥This feature requires --allow-worker if used with the Permission Model.