Skip to content

Conversation

pmachapman
Copy link
Collaborator

@pmachapman pmachapman commented Aug 5, 2025

This PR adds codecov bundle analysis. You can view this information at: https://app.codecov.io/gh/sillsdev/web-xforge/bundles/master


This change is Reviewable

Copy link

codecov bot commented Aug 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.12%. Comparing base (d8afc92) to head (0b96a49).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3347   +/-   ##
=======================================
  Coverage   82.12%   82.12%           
=======================================
  Files         610      610           
  Lines       36406    36406           
  Branches     5995     5995           
=======================================
  Hits        29898    29898           
- Misses       5626     5643   +17     
+ Partials      882      865   -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nateowami Nateowami changed the title Add codecov bundle analysis Add Codecov bundle analysis Aug 6, 2025
@Nateowami
Copy link
Collaborator

Thanks for adding this. I'm hopeful we can reduce our bundle size, but historically it's almost always grown.

It seems pretty silly of Codecov to assume the files won't be compressed. Our main.js file is 1018kB over the network, due to our server not supporting Brotli (I think -- Cloudlfare now supports end-to-end Brotli, so I'm guessing it's our server not supporting it. See https://blog.cloudflare.com/this-is-brotli-from-origin/).

npm run build:stats shows estimated transfer size of 763.51 kB, which I believe is achieved with Brotli level 11. Ideally Apache would compress the files once upon startup, then serve them compressed with hit to performance. It seems like this one change can buy us more efficiency than a lot of work reducing the bundle itself.

@marksvc
Copy link
Collaborator

marksvc commented Aug 8, 2025

Uh oh. The migration to application builder and this commit will need reconciled. I'll plan to look into doing this in application builder.

@marksvc
Copy link
Collaborator

marksvc commented Aug 11, 2025

We can review this PR for its merits against our code repository at present. But it will quickly need reconciled with our frontend's change to application builder 1.

Newer versions of Angular use "application builder" (though still support "browser builder") 2. Our frontend moves to application builder in #3338.

Angular's application builder partly uses Vite. But we can not just add plugins to its usage of Vite 34. However, we can invert how Vite is used and thus use plugins 4. If we were to do this, I would like to see the transition to the application builder working well before making such a change.

Although Angular application builder uses Vite, it really uses esbuild for production 34. But again, it does not seem to be something we can add plugins to as used by angular cli 5. However, we can change our builder to something like @angular-builders/custom-esbuild to use esbuild plugins 6.

I took Peter's PR with builder "@angular-builders/custom-webpack:browser" and tried using ng update. It was not able to apply all the update migrations. We might cause ourselves less hassle by not deviating from the default Angular build system for this reason.

Codecov provides bundle-analyzer which can analyze files independently of the bundler 7. If this would work for us, I suggest we use the bundle-analyzer, with the Angular application builder "@angular-devkit/build-angular:application" (in #3338), rather than a custom layer on top.

Footnotes

  1. https://github.com/sillsdev/web-xforge/pull/3338

  2. https://angular.dev/tools/cli/build-system-migration

  3. https://github.com/just-jeb/angular-builders/issues/1660 2

  4. https://angular.love/angular-analog-and-vite 2 3

  5. https://github.com/just-jeb/angular-builders/issues/1660#issuecomment-1937753871

  6. https://www.npmjs.com/package/@angular-builders/custom-esbuild

  7. https://docs.codecov.com/docs/bundle-analyzer-quick-start

@pmachapman
Copy link
Collaborator Author

@marksvc I think we should keep this PR on ice until after your PR is merged. Codecov analysis does support vite, so we might be able to get it to work then? https://docs.codecov.com/docs/vite-quick-start

@Nateowami
Copy link
Collaborator

Marking this a draft until Angular upgrade is complete

@Nateowami Nateowami marked this pull request as draft August 15, 2025 15:18
@pmachapman pmachapman force-pushed the feature/bundle-analysis branch from 50a6992 to 0b96a49 Compare September 10, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants