Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat(build): enable React Compiler via Vite (babel-plugin-react-compiler)

hairyf811eb03839da
diff --git a/AGENTS.md b/AGENTS.md
index a1739779..e564508e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,7 +36,7 @@ cargo check && cargo test # Rust check & unit tests (run in src-tauri)
## Basics
-- No `useCallback` / `useMemo` — Vite 当前未启用 `react-compiler` 插件,依赖「组件保持轻量、每次渲染重建 inline 函数可接受」的约定,而非编译器自动记忆化
+- No `useCallback` / `useMemo` — `react-compiler` 已通过 Vite 接入(`babel-plugin-react-compiler`,target 19)用于自动记忆化;但禁用手动记忆化钩子仍是「组件保持轻量」的项目约定(每次渲染重建 inline 函数可接受),而非依赖编译器记忆化
- Component functions use `function` declaration; inline events/callbacks use arrow functions
## Function Declaration Specification
diff --git a/package.json b/package.json
index 59fe32f2..d724d6a5 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,7 @@
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"@vitejs/plugin-react": "^4.6.0",
+ "babel-plugin-react-compiler": "^1.0.0",
"bumpp": "12.2.1",
"eslint": "^10.8.1",
"eslint-plugin-react-refresh": "^0.5.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7bf87e16..78ff74aa 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -89,6 +89,9 @@ importers:
'@vitejs/plugin-react':
specifier: ^4.6.0
+ babel-plugin-react-compiler:
+ specifier: ^1.0.0
+ version: 1.0.0
bumpp:
specifier: 12.2.1
version: 12.2.1(patch_hash=362685edd02f1561e78b740e2b4c1ec2bd8e266eb2e26a64055ae305cac1c3ac)
@@ -1690,6 +1693,9 @@ packages:
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
+ resolution: {integrity: sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw==}
+
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
engines: {node: 18 || 20 || >=22}
@@ -4788,6 +4794,10 @@ snapshots:
+ dependencies:
+ '@babel/types': 7.29.8
+
diff --git a/vite.config.ts b/vite.config.ts
index bd3979bf..4f327b50 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -7,7 +7,14 @@ const host = process.env.TAURI_DEV_HOST
// https://vitejs.dev/config/
export default defineConfig(async () => ({
- plugins: [react(), tailwindcss()],
+ plugins: [
+ react({
+ babel: {
+ plugins: [['babel-plugin-react-compiler', { target: '19' }]],
+ },
+ }),
+ tailwindcss(),
+ ],
resolve: {
alias: {