• Version 2.2.2
  • Published
  • 145 kB
  • 4 dependencies
  • MIT license


npm i aurelia-loader-webpack
yarn add aurelia-loader-webpack
pnpm add aurelia-loader-webpack


An implementation of Aurelia's loader interface to enable webpack.



function ensureOriginOnExports

ensureOriginOnExports: (moduleExports: any, moduleId: string) => any;


    class TextTemplateLoader

    class TextTemplateLoader {}
    • An implementation of the TemplateLoader interface implemented with text-based loading.

    method loadTemplate

    loadTemplate: (loader: any, entry: any) => Promise<void>;
    • Loads a template.

      Parameter loader

      The loader that is requesting the template load.

      Parameter entry

      The TemplateRegistryEntry to load and populate with a template. A promise which resolves when the TemplateRegistryEntry is loaded with a template.

    class WebpackLoader

    class WebpackLoader extends Loader {}
    • A default implementation of the Loader abstraction which works with webpack (extended common-js style).



      property hmrContext

      hmrContext: {
      moduleId: string,
      hot: Webpack.WebpackHotModule
      ): Promise<void>;
      handleViewChange(moduleId: string): Promise<void>;

        property loaderPlugins

        loaderPlugins: { [name: string]: any };

          property moduleRegistry

          moduleRegistry: any;

            property modulesBeingLoaded

            modulesBeingLoaded: Map<string, Promise<any>>;

              property templateLoader

              templateLoader: TextTemplateLoader;

                method addPlugin

                addPlugin: (pluginName: string, implementation: any) => void;
                • Registers a plugin with the loader.

                  Parameter pluginName

                  The name of the plugin.

                  Parameter implementation

                  The plugin implementation.

                method applyPluginToUrl

                applyPluginToUrl: (url: string, pluginName: string) => string;
                • Alters a module id so that it includes a plugin loader.

                  Parameter url

                  The url of the module to load.

                  Parameter pluginName

                  The plugin to apply to the module id. The plugin-based module id.

                method loadAllModules

                loadAllModules: (ids: Array<string>) => Promise<any[]>;
                • Loads a collection of modules.

                  Parameter ids

                  The set of module ids to load. A Promise for an array of loaded modules.

                method loadModule

                loadModule: (moduleId: string, defaultHMR?: boolean) => Promise<any>;
                • Loads a module.

                  Parameter moduleId

                  The module ID to load. A Promise for the loaded module.

                method loadTemplate

                loadTemplate: (url: string) => Promise<any>;
                • Loads a template.

                  Parameter url

                  The url of the template to load. A Promise for a TemplateRegistryEntry containing the template.

                method loadText

                loadText: (url: string) => Promise<any>;
                • Loads a text-based resource.

                  Parameter url

                  The url of the text file to load. A Promise for text content.

                method map

                map: (id: string, source: any) => void;
                • Maps a module id to a source.

                  Parameter id

                  The module id.

                  Parameter source

                  The source to map the module to.

                method normalize

                normalize: (moduleId: string, relativeTo: string) => Promise<string>;
                • Normalizes a module id.

                  Parameter moduleId

                  The module id to normalize.

                  Parameter relativeTo

                  What the module id should be normalized relative to. The normalized module id.

                method normalizeSync

                normalizeSync: (moduleId: string, relativeTo: string) => string;
                • Normalizes a module id.

                  Parameter moduleId

                  The module id to normalize.

                  Parameter relativeTo

                  What the module id should be normalized relative to. The normalized module id.

                method useTemplateLoader

                useTemplateLoader: (templateLoader: TextTemplateLoader) => void;
                • Instructs the loader to use a specific TemplateLoader instance for loading templates

                  Parameter templateLoader

                  The instance of TemplateLoader to use for loading templates.

                Type Aliases

                type LoaderPlugin

                type LoaderPlugin = {
                fetch: (
                address: string
                ) => Promise<TemplateRegistryEntry> | TemplateRegistryEntry;

                  Package Files (1)

                  Dependencies (4)

                  Dev Dependencies (4)

                  Peer Dependencies (0)

                  No peer dependencies.


                  To add a badge like this badgeto your package's README, use the codes available below.

                  You may also use to create a custom badge linking to

                  • Markdown
                  • HTML
                    <a href=""><img src="" alt=""></a>