dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Size regression in `main.js` bundle caused by standalone component migration

Open ybnd opened this issue 4 months ago • 2 comments

Describe the bug Looks like migrating to standalone components in #2750 increased the size of our main.js bundle by about 30kB.

While this is not a significant increase, it's a bit counter-intuitive since the claim is that standalone components should improve the bundle structure.

Here are some improvements we can make:

  • Move route-specific components out of ListableModule and reduce the number of imports
    • Mainly: Standalone Item pages, MyDSpace components
    • This can easily save us ~60kB (gz)
    • A little fragile though: we've already seen that overwriting these components in themes causes regressions. We can propose a workaround to mitigate this.
  • Make dynamic form code lazy again
    • Dynamic forms are only used on a select number of routes, many of which are not even accessible by anonymous users, so it would be good to keep them out of the main bundle
    • Looked into this for a short while, and it's not as easy but could save us another ~40kB (gz)

ybnd avatar Apr 05 '24 10:04 ybnd