问题
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