0

I have absolutely no idea why this is happening but every single one of my lazy loaded ionic page loads ALL *.js chunks and I am unable to benefit from lazy loading.

Its a fairly large app. Each page load is downloading about 46mb of data, most of which are all 0.js, 1.js, .... When going to different pages, I don't see any more *.js being downloaded.

Please help!!!!!!.

Lazy Loaded Module

@NgModule({
    imports: [
        IonicPageModule.forChild(PostWidgetComponent)
    ],
    declarations: [
        PostWidgetComponent
    ],
    entryComponents: [],
    providers: [],
    exports: [PostWidgetComponent]
})
export class PostWidgetModule { }

App Module

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    IonicModule.forRoot(AppComponent, {
      preloadModules: true
    }),
    ProvidersModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [AppComponent],
  providers: [
    /*  { provide: ErrorHandler, useClass: IonicErrorHandler }, */
    StatusBar,
    SplashScreen
  ]
})
export class AppModule { }

1 Answer 1

1

This was such a dump mistake that I deleted the answer, but putting the "fix" here for reference. I found the mistake while copying app.module and pasting here :)

IonicModule.forRoot(AppComponent, {
  //preloadModules: true // DELETE DANGER AHEAD
}),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.