diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e436606cf..dca63aadc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -306,7 +306,7 @@ importers: specifier: ^5.9.3 version: 5.9.3 - rsbuild/react-compiler-babel: + rsbuild/react-compiler: dependencies: react: specifier: ^19.3.0 @@ -318,9 +318,6 @@ importers: '@rsbuild/core': specifier: 2.2.12 version: 2.2.12(@module-federation/runtime-tools@2.9.2)(core-js@3.50.0) - '@rsbuild/plugin-babel': - specifier: ^2.1.0 - version: 2.1.0(@rsbuild/core@2.2.12)(@rspack/core@2.2.8)(webpack@5.102.1) '@rsbuild/plugin-react': specifier: ^2.1.1 version: 2.1.1(@rsbuild/core@2.2.12)(@rspack/core@2.2.8) @@ -333,9 +330,6 @@ importers: '@types/react-dom': specifier: ^19.3.0 version: 19.3.0(@types/react@19.3.0) - babel-plugin-react-compiler: - specifier: ^1.0.0 - version: 1.0.0 typescript: specifier: ^5.9.3 version: 5.9.3 @@ -22724,7 +22718,8 @@ snapshots: babel-plugin-react-compiler@1.0.0: dependencies: - '@babel/types': 7.29.7 + '@babel/types': 7.29.8 + optional: true babel-preset-solid@1.9.12(@babel/core@7.29.7)(solid-js@1.9.17): dependencies: diff --git a/rsbuild/react-compiler-babel/rsbuild.config.ts b/rsbuild/react-compiler-babel/rsbuild.config.ts deleted file mode 100644 index 74aa8e4e4..000000000 --- a/rsbuild/react-compiler-babel/rsbuild.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from '@rsbuild/core'; -import { pluginBabel } from '@rsbuild/plugin-babel'; -import { pluginReact } from '@rsbuild/plugin-react'; - -export default defineConfig({ - plugins: [ - pluginReact(), - pluginBabel({ - include: /\.(?:jsx|tsx)$/, - babelLoaderOptions(opts) { - opts.plugins?.unshift('babel-plugin-react-compiler'); - }, - }), - ], -}); diff --git a/rsbuild/react-compiler-babel/.gitignore b/rsbuild/react-compiler/.gitignore similarity index 100% rename from rsbuild/react-compiler-babel/.gitignore rename to rsbuild/react-compiler/.gitignore diff --git a/rsbuild/react-compiler-babel/README.md b/rsbuild/react-compiler/README.md similarity index 66% rename from rsbuild/react-compiler-babel/README.md rename to rsbuild/react-compiler/README.md index 37b1dd332..08070cc28 100644 --- a/rsbuild/react-compiler-babel/README.md +++ b/rsbuild/react-compiler/README.md @@ -1,4 +1,6 @@ -# Rsbuild Project +# Rsbuild + React Compiler + +This example enables the Rust-based React Compiler with `pluginReact({ reactCompiler: true })`. ## Setup diff --git a/rsbuild/react-compiler-babel/package.json b/rsbuild/react-compiler/package.json similarity index 77% rename from rsbuild/react-compiler-babel/package.json rename to rsbuild/react-compiler/package.json index 8a36af2f3..20f192379 100644 --- a/rsbuild/react-compiler-babel/package.json +++ b/rsbuild/react-compiler/package.json @@ -1,5 +1,5 @@ { - "name": "@rsbuild-example/react-compiler-babel", + "name": "@rsbuild-example/react-compiler", "version": "1.0.0", "private": true, "type": "module", @@ -14,12 +14,10 @@ }, "devDependencies": { "@rsbuild/core": "2.2.12", - "@rsbuild/plugin-babel": "^2.1.0", "@rsbuild/plugin-react": "^2.1.1", "@types/node": "^24.19.2", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", - "babel-plugin-react-compiler": "^1.0.0", "typescript": "^5.9.3" } } diff --git a/rsbuild/react-compiler/rsbuild.config.ts b/rsbuild/react-compiler/rsbuild.config.ts new file mode 100644 index 000000000..5fd16a98e --- /dev/null +++ b/rsbuild/react-compiler/rsbuild.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from '@rsbuild/core'; +import { pluginReact } from '@rsbuild/plugin-react'; + +export default defineConfig({ + plugins: [ + pluginReact({ + reactCompiler: true, + }), + ], +}); diff --git a/rsbuild/react-compiler-babel/src/App.css b/rsbuild/react-compiler/src/App.css similarity index 100% rename from rsbuild/react-compiler-babel/src/App.css rename to rsbuild/react-compiler/src/App.css diff --git a/rsbuild/react-compiler-babel/src/App.tsx b/rsbuild/react-compiler/src/App.tsx similarity index 100% rename from rsbuild/react-compiler-babel/src/App.tsx rename to rsbuild/react-compiler/src/App.tsx diff --git a/rsbuild/react-compiler-babel/src/index.tsx b/rsbuild/react-compiler/src/index.tsx similarity index 100% rename from rsbuild/react-compiler-babel/src/index.tsx rename to rsbuild/react-compiler/src/index.tsx diff --git a/rsbuild/react-compiler-babel/tsconfig.json b/rsbuild/react-compiler/tsconfig.json similarity index 100% rename from rsbuild/react-compiler-babel/tsconfig.json rename to rsbuild/react-compiler/tsconfig.json