Provides universal loading of ES Modules / CommonJS on Node and ES Modules in the browser.

ModuleLoaderObj is returned with the loaded module along with metadata that describes the loading mechanism.

Constructors

Methods

Constructors

Methods

  • Type Parameters

    • M
    • E

    Parameters

    • options: {
          modulepath: string | URL;
          resolveModule?: ((M: any) => E);
      }

      Options object.

      • modulepath: string | URL

        A module name, file path, or URL.

      • OptionalresolveModule?: ((M: any) => E)

        An optional function which resolves the import to set instance.

          • (M): E
          • Parameters

            • M: any

            Returns E

    Returns Promise<ModuleLoaderObj<M, E>>

    The module / instance and data about the loading process.