module.register(specifier[, parentURL][, options])
稳定性: 1.2 - 发布候选版
specifier<string> | <URL> 要注册的自定义钩子;这应当与传递给import()的字符串相同,只是如果它是相对路径,则相对于parentURL进行解析。parentURL<string> | <URL> 如果你想要相对于一个基础 URL(例如import.meta.url)解析specifier,你可以在这里传入该 URL。默认值:'data:'options<Object>parentURL<string> | <URL> 如果你想相对于某个基础 URL(例如import.meta.url)解析specifier,可以在此处传入该 URL。如果parentURL作为第二个参数提供,则会忽略此属性。默认值:'data:'data<any> 可以传入到initialize钩子的任意可克隆的 JavaScript 值。transferList<Object[]> 可转移对象 将传入initialize钩子。
注册一个模块,该模块导出 钩子,用于自定义 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.