bug: Loading app resources is slow only on Android
See original GitHub issueBug Report
Ionic version:
[ ] 4.x [x] 5.x
Current behavior:
When running my app on Android, the chunks are lazy loaded when they are needed, although the strategy is PreloadAllModules. First, I thought this was a problem which required me to add the Angular service worker, but with the default configuration provided by the Ionic documentation it still did not work. (On Android with capacitor, http request don’t work either so I added a fix as can be seen in the MainActivity.java).
In my app, I have multiple modules with routes (authorization module, tabs module, detail modules etc.) but when navigating from for instance the login page to a tab page the javascript chunks are loaded when starting the NavController navigateRoot. I did not expect this behavior because the modules are preloaded right?
This behavior only happens on Android. iOS works fine.
Expected behavior:
I expected smooth and fast navigation between pages on Android, similar to the speed of an iOS flavor.
Steps to reproduce:
Related code:
I created a starter template repo configured with the service worker, as I did with my real app.
Clone this repo
npm install
ng build --prod
npx cap sync && npx cap open android
# Run the application on a native device
Capacitor will print a lot of requests to get the files D/Capacitor: Handling local request: http:/localhost/**
Other information:
I got the Android service worker bugfix from here
Ionic info:
Ionic:
Ionic CLI : 6.10.0 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.1.1
@angular-devkit/build-angular : 0.901.7
@angular-devkit/schematics : 9.1.7
@angular/cli : 9.1.7
@ionic/angular-toolkit : 2.2.0
@capacitor : 2.1.2
Utility:
cordova-res : not installed
native-run : 1.0.0
System:
NodeJS : v13.8.0 (/usr/local/bin/node)
npm : 6.14.5
OS : macOS Catalina
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Well, the good old turning the device off and on again worked to fix the performance issue. I still have no clue what exactly caused it. I guess this issue ticket can be closed.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.