Skip to content

build(web): run the React Compiler on worker threads - #727

Merged
badcuban merged 1 commit into
mainfrom
fix/faster-web-build
Oct 31, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/faster-web-build

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

Babel, running the React Compiler, is most of the web app's build time. @rolldown/plugin-babel 0.3 can run it on worker threads (parallel), but only with options it can send to them, and plugin-react's reactCompilerPreset() holds its Babel half as a function, so parallel: true threw.

reactCompilerWorkerPreset() in apps/web/vite.config.ts calls that function once and passes the plain result; the preset's filters and hooks stay in the main process. parallel: true uses up to four workers.

Measured on a Mac:

Before After
vp build (web) 21 s 9.5 s
Dev server, first cold page load 6.4 s 3.5 s
Web browser suite 95 s 78 s
  • Build output is byte-identical (diff -rq of both dist folders).
  • Hot updates still apply on the dev server.
  • The workers add about 350 MB to a running dev server. Two workers would cut that back to little extra but give a 13 s build and a 4.0 s dev load.

Babel, running the React Compiler, is most of the web app's build time.
@rolldown/plugin-babel 0.3 can run it on worker threads, but only with
options it can send to them, and plugin-react's compiler preset holds
its Babel half as a function. We call that function once and pass the
plain result; the preset's filters and hooks stay in the main process.

Measured on this Mac, four workers (the plugin's default cap):
- vp build: 21s to 9.5s, with byte-identical output (diff -rq dist)
- dev server, first cold page load: 6.4s to 3.5s
- web browser suite: 95s to 78s, 927 tests passing
The workers add about 350 MB to a running dev server. Hot updates
still apply.
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Oct 31, 2026 5:23am UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit deee91d Oct 31, 2026
@badcuban
badcuban deleted the fix/faster-web-build branch October 31, 2026 05:32

This branch was previously deployed

1 inactive deployment
Preview — a9a6fa58 Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant