LF-5422 Add bundle size measurement and a committed size baseline for the webapp - #4313
Merged
SayakaOno merged 12 commits intoAug 17, 2026
Conversation
pnpm bundle-snapshot builds the webapp and writes a JSON file describing the result: every file in dist with its raw and gzipped size, its content hash, its category, and whether the Workbox precache manifest lists it. The build runs under a fixed environment recorded as envFingerprint, so a local .env cannot change the measurement. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
pnpm bundle-compare reads two snapshots and reports four blocks: what a first install costs, what is not precached, what a user already on the older build fetches, and the largest changes by name. It refuses to diff two snapshots that were not measured the same way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Covers what a snapshot measures, taking one against a branch or a release, reading the four comparison blocks, the fields in the JSON, and a message-cause-action table for every way a run can fail. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The snapshot records which chunks index.html loads as a module, read from the built HTML. bundle-compare gives that chunk its own line under fetched, and the run fails if the entry cannot be identified. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The steps for taking a release snapshot name the released commit and link the releases page. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Taken with bundle-snapshot --release on 2f9466b, version 3.13.1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Schema 2 Changes: Follow nginx rules for minimum file size and file type for compression; limit hash stripping to /assets/ Also remove --no-build flag; require a clean git tree for --release. Scan build output for unconfigured VITE_ env variables; minor fix for UPDATE name rows; cosmetic changes to bundle-compare console output. Update and clean up documentation and comments.
Taken with 'pnpm bundle-snapshot --release' on a clean tree, branch HEAD
kathyavini
force-pushed
the
LF-5422-add-bundle-size-measurement-and-a-committed-size-baseline-for-the-webapp
branch
from
August 15, 2026 00:06
18a7aea to
b7d6165
Compare
GitHub was rendering all ~15k short lines into the view, and crashing my Chrome
16 tasks
SayakaOno
previously approved these changes
Aug 17, 2026
SayakaOno
left a comment
Collaborator
There was a problem hiding this comment.
It’s great that we can quickly test without building the Docker container, thank you!
pnpm bundle-snapshot --release
Do we want to add this to the release checklists?
Collaborator
Author
|
Thanks @SayakaOno!
That would be great! 🙏 I was thinking around the same time as the backport PR. And hopefully it doesn't become annoying to keep up 🤞 |
SayakaOno
approved these changes
Aug 17, 2026
SayakaOno
deleted the
LF-5422-add-bundle-size-measurement-and-a-committed-size-baseline-for-the-webapp
branch
August 17, 2026 19:52
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.
Description
This PR adds two development-only scripts:
pnpm bundle-snapshotandpnpm bundle-comparethat allow us to track the download costs associated with a given frontend build, and with moving from one build to another.
The use of the scripts is outlined pretty exhaustively in the README.md, so I'll just link there 🙂
This PR also includes output from
pnpm bundle-snapshotagainst our current releasev3.13.1. This snapshot can be compared withpnpm bundle-compareagainst, e.g., the Vite 5 build (seeing the effect of all of those SVGs removed 😍), or againstv3.13.0to evaluate the update costs for this release in particular.E.g. here is some of the
bundle-compareoutput for yesterday's releaseYou can then hand the full snapshots in question to a agent for further querying. For instance, I wanted to know how we got to 2MB of re-download for a release that barely touched the frontend, and the answer, depressingly, was those 3 new strings in 5 languages 😢
The hope is to use and track the snapshots moving forward to quantify the download and re-download costs of what we ship to clients, to test the upcoming tickets in the Network Cost epic, and to identify new candidates for network cost savings.
The committed baseline
bundle-snapshots/3.13.1-e043dd90c.jsonis thev3.13.1release. It names the a commit on this branch rather than the release tag, only because the scripts do not yet exist in the tagged tree, and--releaseenforces a clean (commit-matching) git.As recommended in the readme,
--releasesnapshots moving forward can be generated on the release tag, and it's simplest to do right after release, when packages have not yet diverged.Jira link: https://lite-farm.atlassian.net/browse/LF-5422
Type of change
How Has This Been Tested?
Please see readme!
Some instructive comparisons I recommend:
v3.13.0tov3.13.1v3.13.1toVite 5Note: For older releases that predate the scripts themselves, it's generally easier to request Claude to spin up a worktree and copy the commits over. However, after merge and going forward, the process is just
Checklist:
pnpm i18nto help with this)