Skip to content

Commit 85645ab

Browse files
perf(web): run the React Compiler natively instead of through Babel
The Babel pass for the React Compiler was ~22s of a ~31s cold bundled-dev compile in a fresh worktree. @vitejs/plugin-react 6.1 runs the compiler's Rust port through oxc-transform-react, which drops it to ~2s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b67ac65 commit 85645ab

3 files changed

Lines changed: 224 additions & 64 deletions

File tree

‎apps/web/package.json‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,19 @@
7676
"devDependencies": {
7777
"@effect/platform-node": "catalog:",
7878
"@effect/vitest": "catalog:",
79-
"@rolldown/plugin-babel": "^0.2.0",
8079
"@tailwindcss/vite": "^4.0.0",
8180
"@tanstack/router-plugin": "^1.161.0",
82-
"@types/babel__core": "^7.20.5",
8381
"@types/compression": "^1.8.1",
8482
"@types/culori": "^4.0.1",
8583
"@types/mdast": "^4.0.4",
8684
"@types/react": "~19.3.0",
8785
"@types/react-dom": "~19.2.3",
8886
"@types/react-test-renderer": "19.1.0",
8987
"@vercel/config": "^0.3.0",
90-
"@vitejs/plugin-react": "^6.0.0",
91-
"babel-plugin-react-compiler": "1.0.0",
88+
"@vitejs/plugin-react": "^6.1.2",
9289
"compression": "^1.8.2",
9390
"jsdom": "^30.0.1",
91+
"oxc-transform-react": "~0.152.0",
9492
"react-test-renderer": "19.2.6",
9593
"tailwindcss": "^4.0.0",
9694
"unified": "catalog:",

‎apps/web/vite.config.ts‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as NodeZlib from "node:zlib";
22

3-
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
4-
import babel from "@rolldown/plugin-babel";
3+
import react from "@vitejs/plugin-react";
54
import { tanstackRouter } from "@tanstack/router-plugin/vite";
65
import compression from "compression";
76
import { defineProject, type TestProjectInlineConfiguration } from "vite-plus/test/config";
@@ -174,15 +173,7 @@ export default defineConfig(() => {
174173
// usage code stay out of the cold-start payload; the router prefetches
175174
// them on navigation intent (see getRouter's defaultPreload).
176175
tanstackRouter({ autoCodeSplitting: true }),
177-
react(),
178-
babel({
179-
// We need to be explicit about the parser options after moving to @vitejs/plugin-react v6.0.0
180-
// This is because the babel plugin only automatically parses typescript and jsx based on relative paths (e.g. "**/*.ts")
181-
// whereas the previous version of the plugin parsed all files with a .ts extension.
182-
// This is causing our packages/ directory to fail to parse, as they are not relative to the CWD.
183-
parserOpts: { plugins: ["typescript", "jsx"] },
184-
presets: [reactCompilerPreset()],
185-
}),
176+
react({ compiler: true }),
186177
tailwindPlugins(bundledDev),
187178
],
188179
optimizeDeps: {

0 commit comments

Comments
 (0)