Repository navigation
perf(dashboard): Split first-load vendor code into stable chunks - #2818
Merged
Merged
Conversation
Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
10 screenshot changes — 10 changed · 0 added · 0 removed Review screenshots in Frameshift |
BYK
approved these changes
Nov 7, 2026
23 tasks done
BYK
added a commit
that referenced
this pull request
Nov 9, 2026
…ndor chunk (#2993) After #2818, `vendor` (~227 KB br) still changed in 0.286.0 and 0.287.0, with no dependency change. App code had added lucide icons (`corner-left-up`, then `bell` and `bell-off`). Each new icon adds a module to the chunk that holds lucide. That changed `vendor`'s hash and its export names, so the small app chunks that import from it changed too. This PR adds three groups to `tsdown.client.config.ts`: - **`vendor-icons`:** `lucide-react`. - **`vendor-ui`:** `@base-ui/*`. App code imports Base UI the same way, one component at a time. - **`junior`:** the `@sentry/junior` workspace package. The `vendor` test now checks the whole module path. pnpm injects `@sentry/junior` under `node_modules/.pnpm/...`, so the old lookahead `node_modules[\\/](?!@sentry[\\/]junior)` matched the `.pnpm` segment and let 120 KB of `@sentry/junior` into `vendor`. Its build changes with core releases, so `vendor` could change even when the dashboard didn't. Excluding it from `vendor` without giving it a group of its own split the first load into 31–33 small chunks. The `junior` group keeps it in one chunk. That group has the lowest priority so that `vendor` takes zod first; otherwise zod would come in as a dependency of `@sentry/junior`. ## Which packages get their own group New named imports in the last 21 days of dashboard commits (248 commits), counting only names that were not imported anywhere before: | Package | Commits that add a new import | |---|---| | `lucide-react` (icons) | 28 | | `@base-ui/react` (components) | 11 | | `@tanstack/react-query` (hooks) | 4, one of them type-only | react-query stays in `vendor`. Its new hooks rarely add modules, and another group would cost one more preload. ## Hash stability On both main and this branch I added one new icon (`Anchor`, in `CommandPalette`) to first-load app code and rebuilt. These first-load files got a new hash: | | main | this PR | |---|---|---| | First-load files | 9 | 2 | | Files | `client` (109,104 B), `vendor` (226,584 B), `format`, `PageHeader`, `tooltip`, `PageContentSkeleton`, `button`, `schema`, `skeleton` | `client` (108,873 B), `vendor-icons` (7,190 B) | | First-load bytes to download again (br) | 345,018 B | 116,063 B | | All changed files, including lazy route chunks | 46 files, 560,467 B | 35 files, 238,298 B | ## Cold first load Chromium, built dashboard with mock data, JS only, br-11: | Route | main | this PR | |---|---|---| | `/conversations` | 19 files, 1,889,070 B raw, 465,975 B br | 22 files, 1,888,141 B raw, 469,249 B br | | `/conversations/:id` | 26 files, 2,652,793 B raw, 653,291 B br | 29 files, 2,651,864 B raw, 656,532 B br | - **Preloads:** 18 → 21. - **Lazy code:** none moved into the first load. Raw first-load bytes are the same. - **Cost:** about 3.3 KB br more on a cold load, from the three extra files. | Chunk | raw | br | |---|---|---| | `vendor` (main) | 893,576 | 226,534 | | `vendor` | 552,190 | 142,481 | | `vendor-ui` | 218,712 | 60,737 | | `junior` | 80,308 | 19,457 | | `vendor-icons` | 41,388 | 7,113 | ## Screenshots The pages look the same. The only pixel differences are the live spinner and the thinking shimmer. | | main | this PR | |---|---|---| | Conversations |  |  | | Transcript |  |  | ## Checks - Full dashboard build on Node 24.22.1 - Dashboard unit tests after the build: 408 passed - Dashboard `pnpm typecheck` and root `pnpm lint` pass - `pnpm test:e2e:dashboard`: 128 passed `pnpm dev` links the injected `@sentry/junior` dist to `packages/junior/dist`, so bundles from `pnpm dev` split differently: main gets 31 preloads there. All numbers above come from regular builds, where pnpm syncs the injected copy after `build`. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A596398f356e0f4652790df29aec95726 --> -- [View Session in Sentry](https://sentry.sentry.io/explore/conversations/agent%3A596398f356e0f4652790df29aec95726/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
This branch was successfully deployed
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.
#2765 merged most first-load code into the entry, which grew it to 1,202 KB raw (281 KB br). The entry hash changes on every deploy, so each deploy makes the next visit download all of it again.
This adds rolldown
codeSplitting.groupstotsdown.client.config.ts. Third-party code that the first load imports goes into three vendor chunks:vendor-react: react, react-dom, scheduler, react-routervendor-sentry: the Sentry SDK (@sentry/*except the@sentry/junior*workspace packages)vendor: all other first-loadnode_modulesThe
$initialtag limits each group to modules that the entry imports statically. Lazy pages, the chart, grammars, and wasm stay lazy. App code and workspace packages stay in the entry and route chunks.Hash stability
I built main and this branch, then changed one string (the
CommandPaletteplaceholder) and rebuilt each.The three vendor chunks keep their hashes. The lazy route chunks still change because they import shared app code from the entry. That is the same on main.
vendorvendor-reactvendor-sentryA dependency update changes only the vendor chunk that holds it.
Cold first load
JS fetched by Chromium with the mock dashboard (br-11):
/conversations/conversations/:idmodulepreloads: 22 → 17. The groups also take in 5 small
node_moduleschunks.Screenshots
The pages look the same. The only pixel differences are the loading spinner and the thinking shimmer.
Checks
pnpm typecheck(dashboard) and rootpnpm lintpasspnpm test:e2e:dashboard: 103 passed, 1 failed. The failure isconversations-read-position.spec.ts"catches the reader up on several unread Turns" (toBeInViewport). It is flaky on main too: it failed 3 of 8 runs against a main build.I took the measurements on main
e889f3909, then rebased ontod987bf7dd. The rebase did not touch the build config.via @BYK.
--
View Session in Sentry