Skip to content

docs: dynamic bundle size badges#2402

Open
yslpn wants to merge 2 commits intolingui:mainfrom
yslpn:docs/dynamic-bundle-size-badges
Open

docs: dynamic bundle size badges#2402
yslpn wants to merge 2 commits intolingui:mainfrom
yslpn:docs/dynamic-bundle-size-badges

Conversation

@yslpn
Copy link
Contributor

@yslpn yslpn commented Jan 16, 2026

Description

Replace hardcoded bundle sizes with dynamic bundlejs.com badges in README and docs.

Lightweight and optimized - Core library @lingui/core, React components @lingui/react.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Jan 16, 2026

@yslpn is attempting to deploy a commit to the Crowdin Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.70%. Comparing base (6bb8983) to head (ef7353e).
⚠️ Report is 251 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2402      +/-   ##
==========================================
- Coverage   77.05%   76.70%   -0.35%     
==========================================
  Files          84      100      +16     
  Lines        2157     2752     +595     
  Branches      555      720     +165     
==========================================
+ Hits         1662     2111     +449     
- Misses        382      513     +131     
- Partials      113      128      +15     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vercel
Copy link

vercel bot commented Jan 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
js-lingui Ready Ready Preview Jan 20, 2026 1:43pm

Request Review

@timofei-iatsenko
Copy link
Collaborator

It seems bundlephobia doesn't take into account dev/prod builds and calculating size with a compiler included:

image

Interesting, is it possible to do something with that?

Also badge for the react package doesn't work, i reviewed the link and don't see anything suspicious

@timofei-iatsenko
Copy link
Collaborator

timofei-iatsenko commented Jan 19, 2026

Just leave it here for reference, this is a main function building the package for stats in bundlephobia

https://github.com/pastelsky/package-build-stats/blob/5db72d0ef7d17e6f21adf5d0a7a1e50f0a23ade2/src/utils/build.utils.ts#L190

@timofei-iatsenko
Copy link
Collaborator

So bundlephobia uses rspack with that config to build and generate the stats

We may want to recreate this build locally, and optimize it for bundlephobia. Im not very familiar with rspack, im seeing that they are defining mode: production in the config, but not sure does it mean that NODE_ENV=production is injected.

@timofei-iatsenko
Copy link
Collaborator

Yes it is replacing https://rspack.rs/config/mode#production

So we defenetely need to recreate a local build and understand what go wrong. Probably Lingui's compiler optimization doesn't work properly in rspack

@timofei-iatsenko
Copy link
Collaborator

timofei-iatsenko commented Jan 19, 2026

I created a local project and investigated how that works, actually compiler is not included in the build, because with a compiler size is 8.7 kB

So it's just a stats on bundlephobia are confusing. And proabably effectiveness of the minifier is slightly diffrent to what esbuild do (in our CI)

@yslpn
Copy link
Contributor Author

yslpn commented Jan 19, 2026

Also badge for the react package doesn't work, i reviewed the link and don't see anything suspicious

It worked when I made a pull request. It seems like it's an internal server error in Bundlephobia.

I think we should switch to bundlejs.com. The service has a more user-friendly UI where you can precisely import the necessary functions and view the bundle size.

Most importantly, it allows excluding React from the bundle calculation.

They use esbuild

I added an example of badges to the PR description.

@yslpn
Copy link
Contributor Author

yslpn commented Jan 30, 2026

It's crazy, but all services and badges have stopped working. I'll move it to draft for now.

ref:
pastelsky/bundlephobia#961
okikio/bundlejs#96

@yslpn yslpn marked this pull request as draft January 30, 2026 19:03
@okikio
Copy link

okikio commented Jan 30, 2026

sorry guys that was a glitch on my part, I was fixing some bugs and the badges went down temporarily they are now back up

@yslpn yslpn marked this pull request as ready for review January 30, 2026 20:59
@yslpn
Copy link
Contributor Author

yslpn commented Jan 30, 2026

sorry guys that was a glitch on my part, I was fixing some bugs and the badges went down temporarily they are now back up

Thank you very much for your work! It works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants