Have ideas to improve npm?Join in the discussion! »

    This package has been deprecated

    Author message:

    The string form of `loadChildren` is deprecated, this package is part of its implementation and is no longer needed if not using string form lazy loading. See: https://angular.io/api/router/LoadChildren for more details.

    @nguniversal/module-map-ngfactory-loader
    TypeScript icon, indicating that this package has built-in type declarations

    8.2.6 • Public • Published

    Module Map NgFactory Loader

    This is a NgFactory Loader which uses a map of modules instead of resolving modules lazily.

    This is useful when executing in node because lazy loading serves no purpose

    Usage with @angular/cli

    npm install @nguniversal/module-map-ngfactory-loader --save

    @angular/cli will generate LAZY_MODULE_MAP in its main output bundle if you put app.platform = 'server'.

    const { provideModuleMap } = require('@nguniversal/module-map-ngfactory-loader');
    const { AppModuleNgFactory, LAZY_MODULE_MAP } = require('main.bundle.js');
     
    renderModuleFactory(AppModuleNgFactory, {
      document: '<app-root></app-root>',
      url: '/',
      extraProviders: [
        provideModuleMap(LAZY_MODULE_MAP)
      ]
    })

    Add ModuleMapLoaderModule to your server module

    import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader';
     
    @NgModule({
      imports: [
        AppModule,
        ServerModule,
        ModuleMapLoaderModule
      ],
      bootstrap: [AppComponent],
    })
    export class AppServerModule {}

    Install

    npm i @nguniversal/module-map-ngfactory-loader

    DownloadsWeekly Downloads

    49,334

    Version

    8.2.6

    License

    MIT

    Unpacked Size

    76 kB

    Total Files

    33

    Last publish

    Collaborators

    • avatar