Reputation: 121
I am working in Ionic for couple of months. I developed ionic 2 App with more 10pages and App size was 6Mb after Apk Generated, but in ionic 3 I have not even used more than 8pages and less lines of code then compared to Ionic 2 App. Still my Ionic 3 App Size is 35Mb. Any solution for this?
Note: No images are used for both App,
and is it required to keep .module.ts
in all the pages which is new feature in Ionic 3.
Upvotes: 1
Views: 817
Reputation: 65938
You just need to build your project using below CLI
: It builds the application for production with very small package size. You can see all the build CLI options here.
ionic cordova build android --prod
Q: is it required to keep .module.ts
in all the pages which is new feature in Ionic 3?
A: This is not a must thing. But it is a really awesome feature. It will significantly boost your app's performance.You can read more about lazy loading here.
Upvotes: 1
Reputation: 7507
Check if you are using cordova-plugin-crosswalk-webview
in your new project. This plugin usually adds ~20-30MB to your final .apk size.
You will need an angular-module for every page that has an @IonicPage
decorator. The main advantage of this is that you can utilize lazy-loading (load pages when they are needed, not all of them when the app starts) when you just push a string onto the nav-stack like this: this.nav.push('IonicPageName')
. And of course you have a modularized application which is always good from architecture point of view.
Have a look at the following blog entries by the ionic-team on lazy-loading
Upvotes: 0