Ionic3 lazy loading

Ionic3 uses lazy loading technology by default, compared with the previously preloaded version, the app built by Ionic3 has a large optimization on the home delivery time, but Ionic3 defaults each page corresponding to one module, for the page , How small applications for each module may not be reasonable. Thus, try to combine several small modules into several large modules.

1. A module corresponds to a page:

By default, each page will correspond to a module. If the page among the project is more than the last built item There will be a lot of JS will see.

Import {ngmodule} from ‘@ Angular / Core’; import {ionicpagemodule} from ‘ionic-angular’; import {SettingPage} from ‘./setting’; @NgModule ({declarations: [SettingPage,], imports: [IonicPageModule.forChild (SettingPage),], entryComponents: [SettingPage,]}) export class SettingPageModule {}
  2. A module corresponds to multiple pages  
Modified setting.Module.ts

Import {ngmodule} from ‘@ Angular / Core’; import {ionicpagemodule} From ‘ionic-angular’; import {SettingPage} from ‘./setting’; import {UserPasswordPageModule} from “./user-password/user-password.module”; import {UsernamePageModule} from “./username/username. module “; @NgModule ({declarations: [SettingPage,], imports: [IonicPageModule.forChild (SettingPage), // the introduction of two sub-page module UserPasswordPageModule, UsernamePageModule,], entryComponents: [SettingPage,]}) export class SettingPageModule { }

  The above is the ionic3 lazy load introduced to you, I hope to help everyone. If you have any questions, please leave a message, the small package will reply to everyone in time. Thank you very much for your support of Tumi Cloud Website!  
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment