Skip to content

Commit 28782d1

Browse files
prc5claude
andcommitted
feat: 🎸 React Compiler runs natively through oxc instead of Babel
@vitejs/plugin-react 6.1 can drive oxc's Rust port of React Compiler, so `react({ compiler: true })` replaces the extra @rolldown/plugin-babel pass in the frontend (web, SSR, Electron renderer) and the extension - one transform instead of two, and no Babel in the build graph at all. Verified on all four builds and in dev, where the emitted modules still carry both Fast Refresh registrations and the compiler's memo cache. oxc-transform-react is pinned to ^0.145.0 because that is the peer range plugin-react declares; under 0.x semver the newer 0.147 does not satisfy it. Both the port and the plugin option are flagged experimental upstream, and `compiler: false` is the escape hatch if a component miscompiles. Also carries the pnpm 12 move: packageManager, the backend Dockerfile's corepack line, and the allowBuilds block pnpm 12 now requires. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent ba28a20 commit 28782d1

12 files changed

Lines changed: 4010 additions & 1809 deletions

File tree

‎apps/admin/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"@types/react": "19.2.14",
106106
"@types/react-dom": "19.2.3",
107107
"@types/three": "^0.173.0",
108-
"@vitejs/plugin-react": "^6.0.1"
108+
"@vitejs/plugin-react": "^6.1.1"
109109
},
110110
"nx": {
111111
"targets": {

‎apps/backend/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG NODE_VERSION=24-alpine
55
FROM node:${NODE_VERSION} AS builder
66
WORKDIR /app
77

8-
RUN corepack enable && corepack prepare pnpm@10 --activate
8+
RUN corepack enable && corepack prepare pnpm@12 --activate
99

1010
# .npmrc carries the public-hoist-pattern the workspace relies on. Without it
1111
# pnpm keeps every package isolated, so tsc cannot see types hoisted from other
@@ -35,7 +35,7 @@ FROM node:${NODE_VERSION} AS runner
3535
WORKDIR /app
3636
ENV NODE_ENV=production
3737

38-
RUN corepack enable && corepack prepare pnpm@10 --activate
38+
RUN corepack enable && corepack prepare pnpm@12 --activate
3939

4040
# In a pnpm monorepo the backend's deps are symlinks in apps/backend/node_modules
4141
# pointing into the root .pnpm store, and workspace packages (e.g. @hype-stack/enums)

‎apps/extension/configs/vite.config.mts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import babel from "@rolldown/plugin-babel";
21
import { sentryVitePlugin } from "@sentry/vite-plugin";
32
import tailwindcss from "@tailwindcss/vite";
43
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
54
// @ts-ignore
65
import { tanstackRouter } from "@tanstack/router-plugin/vite";
7-
import { reactCompilerPreset } from "@vitejs/plugin-react";
86
import react from "@vitejs/plugin-react";
97
import { existsSync, readFileSync } from "node:fs";
108
import path from "node:path";
@@ -142,8 +140,7 @@ export default defineConfig(({ mode }) => {
142140
themeBootstrapPlugin(),
143141
manifestPlugin({ browser: targetBrowser, version: appVersion, apiOrigin }),
144142
tailwindcss(),
145-
react(),
146-
babel({ presets: [reactCompilerPreset()] }),
143+
react({ compiler: true }),
147144
svgr(),
148145
];
149146

‎apps/extension/package.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@
7070
"zustand": "^5.0.12"
7171
},
7272
"devDependencies": {
73-
"@rolldown/plugin-babel": "^0.2.3",
7473
"@tailwindcss/vite": "^4.2.4",
7574
"@tanstack/router-plugin": "^1.167.27",
7675
"@types/chrome": "^0.2.5",
7776
"@types/react": "19.2.14",
7877
"@types/react-dom": "19.2.3",
79-
"babel-plugin-react-compiler": "^1.0.0"
78+
"oxc-transform-react": "^0.145.0"
8079
},
8180
"nx": {
8281
"targets": {

‎apps/frontend/configs/vite.renderer.config.mts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import babel from "@rolldown/plugin-babel";
21
import tailwindcss from "@tailwindcss/vite";
3-
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
2+
import react from "@vitejs/plugin-react";
43
import { defineConfig } from "vite";
54
import type { UserConfigFnObject } from "vite";
65
import svgr from "vite-plugin-svgr";
@@ -13,6 +12,6 @@ export default defineConfig((props) => {
1312
const options = config(props);
1413
return {
1514
...options,
16-
plugins: [tailwindcss(), ...(options.plugins || []), react(), babel({ presets: [reactCompilerPreset()] }), svgr()],
15+
plugins: [tailwindcss(), ...(options.plugins || []), react({ compiler: true }), svgr()],
1716
} as ReturnType<UserConfigFnObject>;
1817
});

‎apps/frontend/configs/vite.ssr.config.mts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import babel from "@rolldown/plugin-babel";
21
import tailwindcss from "@tailwindcss/vite";
3-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
4-
// @ts-ignore
5-
import { reactCompilerPreset } from "@vitejs/plugin-react";
62
import react from "@vitejs/plugin-react";
73
import { existsSync } from "fs";
84
import { nitro } from "nitro/vite";
@@ -59,13 +55,12 @@ export default defineConfig((props) => {
5955
plugins: [
6056
tailwindcss(),
6157
...(baseConfig.plugins || []),
62-
react(),
58+
react({ compiler: true }),
6359
// Nitro registers any index.html at the Vite root as its catch-all
6460
// renderer template, which preempts TanStack Start's SSR handler and
6561
// serves that file raw. index.html has to stay at the root for the CSR
6662
// and Electron builds, so Nitro's renderer is what gives way.
6763
nitro({ renderer: false }),
68-
babel({ presets: [reactCompilerPreset()] }),
6964
svgr(),
7065
],
7166
} as ReturnType<UserConfigFnObject>;

‎apps/frontend/configs/vite.web.config.mts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import babel from "@rolldown/plugin-babel";
21
import tailwindcss from "@tailwindcss/vite";
3-
import { reactCompilerPreset } from "@vitejs/plugin-react";
42
import react from "@vitejs/plugin-react";
53
import { existsSync } from "fs";
64
import path from "path";
@@ -53,12 +51,6 @@ export default defineConfig((props) => {
5351
port: 4300,
5452
host: "localhost",
5553
},
56-
plugins: [
57-
tailwindcss(),
58-
...(baseConfig.plugins || []),
59-
react(),
60-
babel({ presets: [reactCompilerPreset()] }),
61-
svgr(),
62-
],
54+
plugins: [tailwindcss(), ...(baseConfig.plugins || []), react({ compiler: true }), svgr()],
6355
} as ReturnType<UserConfigFnObject>;
6456
});

‎apps/frontend/package.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,13 @@
9696
"@electron-forge/plugin-vite": "^7.11.2",
9797
"@electron-forge/publisher-github": "^7.11.2",
9898
"@electron/fuses": "^2.1.3",
99-
"@rolldown/plugin-babel": "^0.2.3",
10099
"@tailwindcss/vite": "^4.2.4",
101100
"@tanstack/router-plugin": "^1.167.27",
102101
"@types/electron-squirrel-startup": "^1.0.2",
103102
"@types/react": "19.2.14",
104103
"@types/react-dom": "19.2.3",
105-
"babel-plugin-react-compiler": "^1.0.0",
106-
"electron": "43.2.0"
104+
"electron": "43.2.0",
105+
"oxc-transform-react": "^0.145.0"
107106
},
108107
"nx": {
109108
"targets": {

‎apps/frontend/src/routeTree.gen.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,3 @@ const rootRouteChildren: RootRouteChildren = {
9393
export const routeTree = rootRouteImport
9494
._addFileChildren(rootRouteChildren)
9595
._addFileTypes<FileRouteTypes>()
96-
97-
import type { getRouter } from "./router.tsx"
98-
import type { createStart } from "@tanstack/react-start"
99-
declare module "@tanstack/react-start" {
100-
interface Register {
101-
ssr: true
102-
router: Awaited<ReturnType<typeof getRouter>>
103-
}
104-
}

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@sentry/node": "^10.50.0",
2828
"@sentry/react": "^10.50.0",
2929
"@sentry/vite-plugin": "^5.2.0",
30-
"@vitejs/plugin-react": "^6.0.1",
30+
"@vitejs/plugin-react": "^6.1.1",
3131
"dotenv": "^17.4.2",
3232
"react": "^19.2.5",
3333
"react-dom": "^19.2.5",
@@ -66,5 +66,5 @@
6666
"shared/*",
6767
"libs/*"
6868
],
69-
"packageManager": "pnpm@10.33.2+sha512.a90faf6feeab71ad6c6e57f94e0fe1a12f5dcc22cd754db40ae9593eb6a3e0b6b12e3540218bb37ae083404b1f2ce6db2a4121e979829b4aff94b99f49da1cf8"
69+
"packageManager": "pnpm@12.1.0+sha512.d9b8276d97f6ec86e49815877f91ee9f63cee61f2063b304e43b6dab8fa07ce8a9afd46d2facd39f921e6a9d06b3c75a81349c7b888c2d22886bae0229901037"
7070
}

0 commit comments

Comments
 (0)