module.register(specifier[, parentURL][, options])


稳定性: 1.1 - 积极开发

¥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 to import(), except that if it is relative, it is resolved relative to parentURL.

  • parentURL <string> | <URL> 如果你想要相对于基本 URL(例如 import.meta.url)解析 specifier,你可以在此处传递该 URL。默认值:'data:'

    ¥parentURL <string> | <URL> If you want to resolve specifier relative to a base URL, such as import.meta.url, you can pass that URL here. Default: 'data:'

  • options <Object>

注册一个导出 钩子 的模块,用于自定义 Node.js 模块解析和加载行为。参见 定制钩子

¥Register a module that exports hooks that customize Node.js module resolution and loading behavior. See Customization hooks.

Node.js 中文网 - 粤ICP备13048890号