Do optimizations need to be applied to the Angular CLI Hello World or is this a valid "performance" result?
In applying Lighthouse to our live angular 4 project, we compared to the Angular CLI Hello World.
From console:
npm install -g @angular/cli
ng new my-dream-app
cd my-dream-app
ng serve --prod
In Chrome -> F12 -> Audits -> Run Lighthouse.
Update 1
Thx to @Moshe, using:
ng serve --prod --build-optimizer
Gave the following: - Performance is 96/100. - First Meaningful Paint is 2,040ms - Perceptual Speed Index: 2,054 (target: < 1,250); Grade of 92/100
Ultimately had a difficult time forming a singular, concise question for this. I understand ng serve
is not for production use, even with ags.. But this allows my to test on my localhost before publishing.
try this:
ng serve --prod --build-optimizer
build-optimizer flag is a new tree-shaking method built on top of the CLI.
ng serve
is not meant to be completely optimized, it is meant to be a quick display of your project for testing. If you want the optimized version you have to run ng build --prod
to generate the files, and then you have to host those files. Do a test on that and it will run much quicker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With