4

I have a large (hundreds of components) angular (5.2.4) app. I upgraded the following, and am able to build clean, but the resulting bundle sizes are larger than with v5:

  • Node.js and Angular CLI updated
  • Http converted to use HttpClient
  • rxjs conversion from 5 to 6 (pipe operators)
  • converted .angular-cli.json to new angular.json
  • removed/replaced any deprecated usage (minimal)

We build using an npm script like the following due to a known issue with the JS heap causing grief:

node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --target=production --aot=true --progress=false --env=STAGING

I revised this script to the following based on commands changing in the angular cli:

node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod --aot --progress=false --c=USER

Prior to upgrading, our main bundle size was ~9MB. After upgrading, it's ~21MB. Any thoughts or suggestions to diagnose this would be greatly appreciated!

skeize
  • 81
  • 4
  • https://angular.io/guide/deployment#inspect-the-bundles. Even 9MB is an awful lot. Why don't you use lazy loading? – JB Nizet Jun 14 '18 at 21:41
  • My build size was at around 7MB+ on 1.7.4 (I know it was big already), but now it's 40.5MB! This is with --prod. Without prod it became almost twice as much which is insane. I'm really happy to hear if you find some reasons for this... – Juhana Pietari Lehtiniemi Jun 15 '18 at 13:12

1 Answers1

0

With the very little information that you provided. I assume that since Rxjs changes the way we import stuff, you may have stacked imports types 5 & 6

Taha Zgued
  • 1,088
  • 12
  • 18