ResolveHook
typealias ResolveHook = (specifier: String, context: ResolveHookContext, nextResolve: (specifier: String, context: ResolveHookContext?) -> PromiseResult<ResolveFnOutput>) -> PromiseResult<ResolveFnOutput>(source)
The resolve
hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as 'module'
) as a hint to the load
hook. If a format is specified, the load hook is ultimately responsible for providing the final format
value (and it is free to ignore the hint provided by resolve
); if resolve
provides a format, a custom load
hook is required even if only to pass the value to the Node.js default load
hook.
Parameters
specifier
The specified URL path of the module to be resolved
context
nextResolve
The subsequent resolve
hook in the chain, or the Node.js default resolve
hook after the last user-supplied resolve hook