Bundle size after migrating to all standalone and implementing lazy loading

26 Views Asked by At

Initially I had implemented a single module per component, and module-based lazy-loading in my app. At that time my main.js bundle size was 2mb. Now I converted to all standalone components and implemented lazy loading for standalone components. Now my bundle size is 4mb. Any idea what can be the root problem or a solution? Has anyone else faced this issue?

  1. I verified the vendorChunk in build config, it's already true.
  2. I tried optimising the lazy loading as much as possible.
1

There are 1 best solutions below

0
shindetsu On

No, Angular's lazy loading feature does not reduce the bundle size, it only loads a fraction of the bundle (on demand) -AKA chunk- instead of loading it entirely. So for your case, bundle size wont decrease from 4MB, but also wont load 4MB at once.