Mohan Gopi Mohan Gopi - 5 months ago 43
HTML Question

static content page in ionic takes time to load first time on mobile

I have static page which contains more then 300 lines of text in the html page.

<ion-content>
<p text-warp>
//my text with
</p>
</ion-content>


In my browser i am able to navigate to my static page immediately but after build to my mobile at first time it take lot of time to navigate to that page.

i have tested this with 3 mobiles same result.

i am using
ionic cordova build android


What might cost the issue

output of
ionic info


global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0


local packages:

@ionic/app-scripts : 1.3.8
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.4.2


System:

Node : v6.11.1
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10

Answer Source

You need to use --prod option with your CLI command.It Marks as a production build.

ionic cordova run android --prod

after using the above command the build will be optimized

Here is the ionic cordova run Options

--prod triggers a production build of Ionic, which is then put into the Cordova container you chose (android or ios).

These tasks are available within ionic-app-scripts:

Reference:

enter image description here