NgFactoryLoader which uses a Map to load ngfactories without lazy loading


stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
3,770128Jun 19, 2021Jun 24, 2015Minified + gzip package size for @nguniversal/module-map-ngfactory-loader in KB


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: [

Add ModuleMapLoaderModule to your server module

import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader';

  imports: [
  bootstrap: [AppComponent],
export class AppServerModule {}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.