LoadHook

typealias LoadHook = (url: String, context: LoadHookContext, nextLoad: (url: String, context: LoadHookContext?) -> PromiseResult<LoadFnOutput>) -> PromiseResult<LoadFnOutput>(source)

The load hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. It is also in charge of validating the import assertion.

Parameters

url

The URL/path of the module to be loaded

context

Metadata about the module

nextLoad

The subsequent load hook in the chain, or the Node.js default load hook after the last user-supplied load hook