Skip to content

Reduce production framework bundle size - #158

Merged
trueadm merged 6 commits into
mainfrom
codex/bundle-size
Jul 18, 2026
Merged

trueadm merged 6 commits into
mainfrom
codex/bundle-size

Conversation

@trueadm

@trueadm trueadm commented Jul 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • isolate transition/offscreen swaps behind a retained capability so ordinary control flow does not keep the full transition graph
  • separate compiler-proven void component calls from dynamic-host and generic returned-value reconciliation, including production proof across relative imports
  • lower safe null-only guards and statically authored ErrorBoundary JSX to direct control-flow primitives
  • emit narrow boolean and ARIA attribute writers when the compiler knows the complete attribute contract
  • refresh the deterministic bundle-size baseline, website summary, regression coverage, and Octane changeset

Why

The benchmark chunks were being split, but broad runtime call edges kept optional feature graphs reachable inside the framework chunk. In particular, ordinary component/control-flow paths retained transition swaps, dynamic host handling, generic returned-value reconciliation, and generic attribute routing even when the application did not need them.

Bundle impact

Fresh normalized-minify builds against current main:

Fixture main framework gzip PR framework gzip Change
rows 16,346 B 16,346 B unchanged
TodoMVC 17,836 B 17,653 B -183 B (-1.0%)
chat-stream 17,293 B 17,098 B -195 B (-1.1%)
weather-app 33,372 B 20,506 B -12,866 B (-38.6%)

Weather total gzip falls from 41,175 B to 28,181 B (-31.6%). Its framework payload is now 2,194 B / 12.0% above Svelte instead of 15,060 B / 82.2% above.

Validation

  • pnpm test — 1,139 files / 11,087 tests passed
  • pnpm typecheck
  • pnpm format:check
  • node benchmarks/bench.mjs --record --ratios bundle-size — all 17 applicable ratio guards passed

Note

Medium Risk
Touches core runtime (component slots, transitions, SSR try boundaries) and broad compiler lowering; behavior is heavily tested but regressions could affect hydration, Suspense, or ErrorBoundary reset flows.

Overview
Production builds drop optional runtime graphs from the framework chunk when apps never use them. Transition off-screen swaps install only when startTransition() runs, so ordinary @if/component paths no longer retain the WIP/Suspense swap machinery.

The compiler specializes more call sites: void components (including memo wrappers and if (!x) return null guards) can use componentSlotVoid with cross-module proof via findVoidComponentImports; static ErrorBoundary JSX lowers to tryBlock/ssrTry with propagateSuspense; boolean and lowercase aria-* attrs emit setBooleanAttribute / setAriaAttribute instead of generic setAttribute. Dynamic host tags and value-return reconciliation stay on the generic componentSlot path.

Bundle baselines, website benchmark ratios, tests, and a patch changeset are updated; weather-app framework gzip drops sharply (~39k → ~21k in the baseline).

Reviewed by Cursor Bugbot for commit acee214. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 18, 2026 12:17pm
octane-website-mcp Ready Ready Preview, Comment Jul 18, 2026 12:17pm

Request Review

Comment thread packages/octane/src/compiler/compile.js Resolved
@trueadm
trueadm marked this pull request as ready for review July 18, 2026 10:50
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 18, 2026 11:06 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 18, 2026 11:07 Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dfec189. Configure here.

Comment thread packages/octane/src/compiler/compile.js Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 18, 2026 11:50 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 18, 2026 11:50 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 18, 2026 12:17 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 18, 2026 12:17 Inactive
@trueadm
trueadm merged commit aabf79c into main Jul 18, 2026
45 of 57 checks passed
@trueadm
trueadm deleted the codex/bundle-size branch July 18, 2026 12:35

This branch was previously deployed

2 inactive deployments
Preview – octane-website — acee214c Deployed Jul 18, 2026 by vercel[bot]
Preview – octane-website-mcp — acee214c Deployed Jul 18, 2026 by vercel[bot]
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.

1 participant