From 392b2f78afa309604036b9b597e78189a1a77c25 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sat, 31 Jan 2026 22:45:11 +0100 Subject: [PATCH] chore: enable react compiler --- bun.lock | 6 ++++++ package.json | 2 ++ vite.config.ts | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bun.lock b/bun.lock index e2958439..f30ed7db 100644 --- a/bun.lock +++ b/bun.lock @@ -83,6 +83,7 @@ "@types/react": "^19.2.10", "@types/react-dom": "^19.2.3", "@types/semver": "^7.7.1", + "babel-plugin-react-compiler": "^1.0.0", "dotenv-cli": "^11.0.0", "drizzle-kit": "^0.31.7", "lightningcss": "^1.31.1", @@ -95,6 +96,7 @@ "typescript": "^5.9.3", "vite": "^7.3.1", "vite-bundle-analyzer": "^1.2.3", + "vite-plugin-babel": "^1.4.1", "vite-tsconfig-paths": "^6.0.5", }, }, @@ -683,6 +685,8 @@ "babel-dead-code-elimination": ["babel-dead-code-elimination@1.0.11", "", { "dependencies": { "@babel/core": "^7.23.7", "@babel/parser": "^7.23.6", "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" } }, "sha512-mwq3W3e/pKSI6TG8lXMiDWvEi1VXYlSBlJlB3l+I0bAb5u1RNUl88udos85eOPNK3m5EXK9uO7d2g08pesTySQ=="], + "babel-plugin-react-compiler": ["babel-plugin-react-compiler@1.0.0", "", { "dependencies": { "@babel/types": "^7.26.0" } }, "sha512-Ixm8tFfoKKIPYdCCKYTsqv+Fd4IJ0DQqMyEimo+pxUOMUR9cVPlwTrFt9Avu+3cb6Zp3mAzl+t1MrG2fxxKsxw=="], + "bail": ["bail@2.0.2", "", {}, "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw=="], "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], @@ -1551,6 +1555,8 @@ "vite-node": ["vite-node@3.2.4", "", { "dependencies": { "cac": "^6.7.14", "debug": "^4.4.1", "es-module-lexer": "^1.7.0", "pathe": "^2.0.3", "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" }, "bin": { "vite-node": "vite-node.mjs" } }, "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg=="], + "vite-plugin-babel": ["vite-plugin-babel@1.4.1", "", { "peerDependencies": { "@babel/core": "^7.0.0", "vite": "^2.7.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" } }, "sha512-quO+viHGSv1cjbfhbeiMZ7SZpo8P29NiUh9LJfKhpmIDwy0THRiTRUbanBbkNcZcSyHFgp1n7TByd1C2kanqLQ=="], + "vite-tsconfig-paths": ["vite-tsconfig-paths@6.0.5", "", { "dependencies": { "debug": "^4.1.1", "globrex": "^0.1.2", "tsconfck": "^3.0.3" }, "peerDependencies": { "vite": "*" } }, "sha512-f/WvY6ekHykUF1rWJUAbCU7iS/5QYDIugwpqJA+ttwKbxSbzNlqlE8vZSrsnxNQciUW+z6lvhlXMaEyZn9MSig=="], "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], diff --git a/package.json b/package.json index 107a33f4..6e90d78e 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,7 @@ "@types/react": "^19.2.10", "@types/react-dom": "^19.2.3", "@types/semver": "^7.7.1", + "babel-plugin-react-compiler": "^1.0.0", "dotenv-cli": "^11.0.0", "drizzle-kit": "^0.31.7", "lightningcss": "^1.31.1", @@ -115,6 +116,7 @@ "typescript": "^5.9.3", "vite": "^7.3.1", "vite-bundle-analyzer": "^1.2.3", + "vite-plugin-babel": "^1.4.1", "vite-tsconfig-paths": "^6.0.5" }, "overrides": { diff --git a/vite.config.ts b/vite.config.ts index bf64b6ee..f8f8933d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,9 +3,22 @@ import tailwindcss from "@tailwindcss/vite"; import { defineConfig } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; import { reactRouterHonoServer } from "react-router-hono-server/dev"; +import babel from "vite-plugin-babel"; export default defineConfig({ - plugins: [reactRouterHonoServer({ runtime: "bun" }), reactRouter(), tailwindcss(), tsconfigPaths()], + plugins: [ + reactRouterHonoServer({ runtime: "bun" }), + reactRouter(), + babel({ + filter: /\.[jt]sx?$/, + babelConfig: { + presets: ["@babel/preset-typescript"], + plugins: [["babel-plugin-react-compiler"]], + }, + }), + tailwindcss(), + tsconfigPaths(), + ], build: { outDir: "dist", sourcemap: false,