为什么我的Angular App性能低?

时间:2019-03-07 08:32:31

标签: angular optimization angular-universal

嗨,我在Angular应用上使用Service Worker和Server Side Rendering工作 我[删除所有超时,使应用程序模块变亮并减少呈现的html]我的google test speed在移动设备上的应用达到约50%,而灯塔达到60%

  

我的应用模块

@NgModule({
  imports: [
    BrowserModule.withServerTransition({
      appId: 'easy-school'
    }),
    FormsModule,
    AppRoutingModule,
    HttpClientModule,
    CoreModule,
    NgxJsonLdModule,
    ReactiveFormsModule,
    LazyLoadImagesModule,
    AppRoutingModule,
    BrowserTransferStateModule,
    RouterModule,
    DirectiveSharedModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
      },
      isolate: true
    })
  ],
  declarations: [
    AppComponent,
    NotFoundPageComponent,
    DownloadAppComponent,
    FooterComponent,
    NavBarComponent,
    AskQuestionComponent,
    AlertComponent
  ],
  providers: [
    {
      provide: LOCALE_ID, useValue: environment.locale
    },
  ],
  bootstrap: [AppComponent]
})
  

服务器模块

@NgModule({
  imports: [
    AppModule,
    ServerModule,
    RouterModule.forRoot([
      { path: 'shell', component: AppShellComponent }
    ]),
    ModuleMapLoaderModule,


  ],
  providers: [
    {
      provide: NgModuleFactoryLoader,
      useClass: ModuleMapNgFactoryLoader
    }
  ],
  bootstrap: [AppComponent],
  declarations: [AppShellComponent],
})

page test screan

0 个答案:

没有答案