Type Alias ModuleLoaderObj<M, E>

The object passed back from ModuleLoader.load.

type ModuleLoaderObj<M, E> = {
    filepath: string;
    instance: E;
    isESM: boolean;
    loadpath: string;
    module: M;
    modulepath: string | URL;
    type:
        | "import-module"
        | "import-path"
        | "import-url"
        | "require-module"
        | "require-path"
        | "require-url";
}

Type Parameters

  • M
  • E
Index

Properties

filepath: string

If available the file path on Node otherwise this will match loadpath in the browser.

instance: E

Either the module itself or any particular export the resolveModule function selects.

isESM: boolean

Indicates if the import was an ES Module.

loadpath: string

A string representation of the module path being loaded.

module: M

The direct module import.

modulepath: string | URL

The initial string or URL sent to ModuleLoader.

type:
    | "import-module"
    | "import-path"
    | "import-url"
    | "require-module"
    | "require-path"
    | "require-url"

The type and how the module was loaded.