Skip to content

Commit 62413be

Browse files
committed
fix: update React Compiler setup for @vitejs/plugin-react v6
- Switch from deprecated babel config to @rolldown/plugin-babel + reactCompilerPreset() - Add @rolldown/plugin-babel@^0.2.1 to catalog and devDependencies - Add @types/babel__core for proper type resolution in pnpm workspaces
1 parent 88ff318 commit 62413be

File tree

7 files changed

+314
-17
lines changed

7 files changed

+314
-17
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@
489489
"@eslint-react/eslint-plugin": "^2.13.0",
490490
"@eslint/js": "^10.0.1",
491491
"@eslint/markdown": "^7.5.1",
492+
"@rolldown/plugin-babel": "catalog:",
492493
"@tanstack/react-query": "catalog:",
493494
"@testing-library/jest-dom": "^6.9.1",
494495
"@testing-library/react": "^16.3.2",

packages/tasks/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"react-dom": "catalog:"
2121
},
2222
"devDependencies": {
23+
"@rolldown/plugin-babel": "catalog:",
2324
"@types/react": "catalog:",
2425
"@types/react-dom": "catalog:",
2526
"@vitejs/plugin-react": "catalog:",

packages/webview-shared/createWebviewConfig.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import react from "@vitejs/plugin-react";
1+
import babel from "@rolldown/plugin-babel";
2+
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
23
import { resolve } from "node:path";
34
import { defineConfig, type UserConfig } from "vite";
45

@@ -16,13 +17,7 @@ export function createWebviewConfig(
1617
return defineConfig({
1718
// Use relative URLs for assets (fonts, etc.) in CSS
1819
base: "./",
19-
plugins: [
20-
react({
21-
babel: {
22-
plugins: [["babel-plugin-react-compiler", {}]],
23-
},
24-
}),
25-
],
20+
plugins: [react(), babel({ presets: [reactCompilerPreset()] })],
2621
build: {
2722
outDir: resolve(dirname, `../../dist/webviews/${webviewName}`),
2823
emptyOutDir: true,

packages/webview-shared/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
}
4242
},
4343
"devDependencies": {
44+
"@types/babel__core": "^7.20.5",
4445
"@types/react": "catalog:",
4546
"@types/vscode-webview": "catalog:",
4647
"@vscode-elements/react-elements": "catalog:",

0 commit comments

Comments
 (0)