3
votes

So with Ionic 3 lazy loading of pages and components was introduced into the framework. I have app optimized to lazy load all the pages now but it still has a slow startup time. I do however use a lot of native plugins which I think might be the reason for this slow start up.

Now in Ionic the native plugins are wrapped in Angular, so would it be possible to also lazy load the plugins so that the plugins, which might only come into play at certain moments of app usage, won't get loaded until necessary hence improving boot performance?

2
What command do you use when deploying to your device? Make sure to use the --prod flag, to ensure that your web content will be minified. ionic run android --prod This will improve your startup time. - robbannn
Are you using ionic native v 3+? - misha130

2 Answers

7
votes

I guess you could remove the native plugins from your main app.module.ts and add it to the component's module that's actually using the plugin. That way the plugin will only be called when the module it's loaded.

-2
votes

You don't need to add any plugin for lazy loading. Go to your app.componer.ts file just change rootPage:any = HomePage; to rootPage:string = "HomePage";. You don't need import your file.