ResolveHook
typealias ResolveHook = (specifier: String, context: ResolveHookContext, nextResolve: (specifier: String, context: ResolveHookContext?) -> <Error class: unknown class><ResolveFnOutput>) -> <Error class: unknown class><ResolveFnOutput>(source)
The resolve
hook chain is responsible for telling Node.js where to find and how to cache a given import
statement or expression, or require
call. It can optionally return a 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.