You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ng serve is about 5 times slower when compiling with IonicModule (Angular 7) #16979
Current behavior:
A brand new angular project has a compile time < 1 second. When I add @ionic/angular , the compile time becomes on average > 5 seconds when using it with ng serve
Any idea why this happens? Is this an ionic issue?
Expected behavior:
Expected compile time to be as fast as Ionic3 or faster.
Steps to reproduce:
1, Start a new angular project
2. run ng serve, change app.component.htm multiple times and notice how the compile time is < 1seconds after a couple compiles
2. run npm i @ionic/angular
3. Add IonicModule to the angular module
4. run ng serve and notice how the average time is now > 5 seconds.
Related code:
Other information:
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.6.0
System:
NodeJS : v10.15.0
npm : 6.5.0
OS : Windows 10
I tried it and it's about the same. Here's my package.json after adding your suggestion.
As soon as I add IonicModule.forRoot(), my compile time becomes > 5 seconds up from under 1 second. It's also worth noting that also if I add IonButtononly to the module as part of the declarations, build time goes up to ~4 seconds. Remove it again and back down to under 1second. I do realize Ionic's approach is to leave it all to the framework, but the angular framework seems to be doing fine on this one.
It's because IonicModule imports a lot of components and so every time you make a change it needs a lot of time to compile (we had this discussion here #16937). Angular uses webpack and this is not very fast. Hopefully the Angular team finds something to make faster compiles or the IonicModule has to be changed. If anyone has an idea to make IonicModule faster, please send a comment :)
But there is already a PR in work, so maybe this already can improve the compile speed -> #16966
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.
Activity
hiepxanh commentedon Jan 7, 2019
please provide
package.jsonand try replaceangular-devkitto this version"@angular-devkit/build-angular": "~0.10.7",tonyawad88 commentedon Jan 7, 2019
I tried it and it's about the same. Here's my package.json after adding your suggestion.
As soon as I add
IonicModule.forRoot(), my compile time becomes > 5 seconds up from under 1 second. It's also worth noting that also if I addIonButtononly to the module as part of thedeclarations, build time goes up to ~4 seconds. Remove it again and back down to under 1second. I do realize Ionic's approach is to leave it all to the framework, but the angular framework seems to be doing fine on this one.tonyawad88 commentedon Jan 7, 2019
Mini demo of the issue: (Note the time on the compiles)

paulstelzer commentedon Jan 7, 2019
It's because
IonicModuleimports a lot of components and so every time you make a change it needs a lot of time to compile (we had this discussion here #16937). Angular uses webpack and this is not very fast. Hopefully the Angular team finds something to make faster compiles or the IonicModule has to be changed. If anyone has an idea to make IonicModule faster, please send a comment :)But there is already a PR in work, so maybe this already can improve the compile speed -> #16966
manucorporat commentedon Jan 8, 2019
Tracking progress here: #17001
Thanks for the issue report!
ionitron-bot commentedon Feb 7, 2019
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.