My app takes way too long to compile. Is there a way I can make this compile a bit faster?
The app functions properly and optimally in the browser (which I want), but it takes at minimum 40 minutes, its been like this for months; here are the details I have:
Ionic V3.
Pages: 75 pages (No Lazy Loading)
3 Services and 2 pipes.
ionic app scripts 3.1.11 (only one that works for my package)
Ionic:
Ionic CLI : 6.10.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : ionic-angular 3.6.0
@ionic/app-scripts : 3.1.11
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 7.1.4, browser 5.0.4, ios 4.5.5
Cordova Plugins : no whitelisted plugins (7 plugins total)
Utility:
cordova-res : not installed
native-run : 1.0.0
System:
NodeJS : v10.12.0 (/usr/local/bin/node)
npm : 6.14.6
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61
If you are using a HDD, then its a factor, i don’t know if its the only issue at play.
So, when i first started using ionic v1, compilation time was around 15-30 seconds on my laptop, when i switched to using ionic 4+ compilation time jumped to 8-10 mins, due to the translation of typescript to plain js, one of the bottlenecks was that my laptops HDD was very slow moving 1000’s of tiny files, switching to an SSD reduced the compilation time to less than a min on my laptop.
Wow! I should have read the docs before using Angular. My ts files are way larger! Perhaps I used a wrong framework, I have for instance a PDF templates ts file for over 75 forms in the system, and each form has about 300 lines of code. And other much larger ts files that don’t make sense splitting components just to reduce the number of lines of code.
well, I am not claiming the 4000 lines are the cause of the performance degradation. It just triggers a reaction. And you can have your own style guide, providing you are consistent, I guess.
Did u measure performance of hdd, cpu and memory? If there is lots of HDD action, then the earlier advice on going to SDD is pretty valid and worth the bucks
Not yet, but I will need to compare with SSD. Unfortunately in my locale, we are still under corona lock-down so when things ease, I’ll purchase, install and compare. Thanks for the insight!
the only app/dev I’ve know with 40mins compile times had a large app with a lot of components and routes that required a lot of analysis and was also on Ionic 3.
With the tools and updates applied to v4 and subsequently to v5, the best advice I could give would be to upgrade your app to the latest or reduce your app size.
Since reducing the app size is not an option, I will have to upgrade. I have always been afraid it will break several things when I upgrade and I’d not have enough time to fix them all amidst development as the application is still taking on several more features. But I’ll give it a try and reply back. Thanks!
Back in the days (MS DOS), when the HDD was slow, we would use a ram disk… Even faster then SSD (wich did not exist by the time). Would that still be possible?