After using ModuleMapLoaderModule, page is loading twice

a 夏天 提交于 2021-02-11 16:17:37

问题


Can someone pls help Website, page is loading twice after using ModuleMapLoaderModule, if i dont using it source code not showing in angular 7 universal Im also getting low speed at google insight and gtmatrix

const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main');
try {
  // * NOTE :: leave this as require() since this file is built Dynamically from webpack
  const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main');
  const { MODULE_MAP } = require('@nguniversal/module-map-ngfactory-loader');

  app.engine('html', ngExpressEngine({
    bootstrap: AppServerModuleNgFactory,
    providers: [
      {
        provide: MODULE_MAP,
        useValue: 'lazy'
      }
    ]
  }));

  app.set('view engine', 'html');
  app.set('views', join(DIST_FOLDER, 'browser'));
} catch (err) {
  console.log(err);
}

App.server.module
imports: [
    AppModule,
    ServerModule,
    ModuleMapLoaderModule,
    // ServerTransferStateModule,
    BrowserModule.withServerTransition({ appId: 'app-root' })
  ],

来源:https://stackoverflow.com/questions/65233739/after-using-modulemaploadermodule-page-is-loading-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!