I m using angular-cli
, now at version 1.0.0.-beta.17, as scaffolding for an Angular2 app that is the "head" of a "headless cms". (These terms means that the CMS is only a data store, it doesn't render pages. Rendering is done in the Angular client).
The CMS content is fetched using the methods outlined in How to pass parameters rendered from backend to angular2 bootstrap method. (I tried both APP_INITIALIZER
and the AppModule.constructor()
variants).
My problem is that the site is too slow on initial load: 2 seconds to page rendered on a fast client. Site is built using ng build -prod
, which produces a decently small bundle (styles+scripts+main=550kB).
Here is a graph of a typical load on a pretty fast client computer:
The big issue here is the 1.2 seconds that pass from when Angular is completely loaded to when the APP_INITIALIZER
methods actually run. On mobiles and slower devices it is worse :-(
The majority of the tips on how to optimize Angular are for version 1.
Anyone have tips on what I can do to to shorten the init times?