Repository navigation
ci(core): bundle-size gate for every export entry - #372
Merged
Merged
Conversation
scripts/bundle-size.mjs bundles each JS entry in core's exports (98 of them, the per-component subpaths included) the way an app would: minified, peers external, CSS modules counted. It also measures the two stylesheets, gzipped. Sizes are compared with bundle-size.json, and the step fails when an entry grows by more than 5% and 512 B. Record an intended growth with --update. It runs as a step in the existing build job and takes a few seconds. esbuild 0.27.7 is already in the lockfile. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1
Member
Author
|
Docs build fails here on Generated by Claude Code |
…feat/bundle-size-gate
…chunks Bundled without splitting, esbuild inlines each import() into the entry, so the gate counted Icon's lazy tooltip card in every component that draws an icon. With splitting, an entry costs itself and the chunks it imports statically. Re-recorded on the 3.0 branch with #374 in it: Button 35.3 -> 24.1 KB, Icon 31.3 -> 19.8 KB, ./code 49.0 -> 25.0 KB. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: nothing measured what an import of core costs, so a component that started pulling in half the library would go unnoticed.
After: CI measures every entry point in
exports, gzipped, and fails when one grows more than 5% and 512 B pastpackages/core/bundle-size.json. That covers 98 entries, including the new./components/<Name>subpaths from #358, pluscss/styles.cssandcss/tokens.css. Current largest:How:
scripts/bundle-size.mjsbundles each entry with esbuild the way an app's bundler would:A new or removed entry also fails the check until it is recorded. When an entry is meant to grow, run
node scripts/bundle-size.mjs --updatein the same PR, so the size change shows in the diff.It runs as one step in the existing "Build, typecheck and test" job, after the build it already does. It takes about 4 s and needs no new job, so it costs almost no extra CI minutes.
[email protected]is a new devDependency but was already in the lockfile.Checked:
--updatethen a check run locally gives "every entry is within 5%". Biome is clean.Generated by Claude Code