M
module.register
History
Added in: v20.6.0, v18.19.0
v20.6.0, v18.19.0
Deprecated in: v25.9.0
v25.9.0
Introduced in: v12.20.0
v12.20.0
Runtime deprecation (DEP0205).
v26.0.0
Using this feature with the permission model enabled requires passing
--allow-worker.v23.6.1, v22.13.1, v20.18.2
Add support for WHATWG URL instances.
v20.8.0, v18.19.0
module.register(specifier, parentURL?, options?): void
Stability: 0Deprecated: Use
module.registerHooks() instead.Attributes
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.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:
ObjectIf you want to resolve
specifier relative to a
base URL, such as import.meta.url, you can pass that URL here. This
property is ignored if the parentURL is supplied as the second argument.
Default: 'data:'data:
anyAny arbitrary, cloneable JavaScript value to pass into the
initialize hook.transferList:
Object[]transferable objects to be passed into the
initialize hook.Register a module that exports hooks that customize Node.js module resolution and loading behavior. See Customization hooks.
This feature requires --allow-worker if used with the Permission Model.