Skip to content

Commit 8c07450

Browse files
committed
feat: add the react compiler for speed optimization
1 parent b298b32 commit 8c07450

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

package-lock.json

Lines changed: 24 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
"react-dom": "19.2.0",
2929
"react-icons": "^5.5.0",
3030
"react-router": "7.9.3",
31-
"simplebar-react": "^3.3.2"
31+
"simplebar-react": "^3.3.2",
32+
"vite-plugin-babel": "^1.3.2"
3233
},
3334
"devDependencies": {
35+
"@babel/preset-typescript": "^7.27.1",
3436
"@react-router/dev": "7.9.3",
3537
"@testing-library/dom": "^10.4.0",
3638
"@testing-library/jest-dom": "^6.6.3",
@@ -40,6 +42,7 @@
4042
"@types/node": "20",
4143
"@types/react": "19.2.0",
4244
"@types/react-dom": "19.2.0",
45+
"babel-plugin-react-compiler": "^19.1.0-rc.3",
4346
"jsdom": "27.0.0",
4447
"prettier": "^3.5.3",
4548
"sass-embedded": "1.93.2",

vite.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
import { reactRouter } from "@react-router/dev/vite";
22
import * as path from "node:path";
33
import { defineConfig } from "vite";
4+
import babel from "vite-plugin-babel";
45
import tsconfigPaths from "vite-tsconfig-paths";
56

67
export default defineConfig({
7-
plugins: [!process.env.VITEST && reactRouter(), tsconfigPaths()],
8+
plugins: [
9+
!process.env.VITEST && reactRouter(),
10+
tsconfigPaths(),
11+
babel({
12+
filter: /\.[jt]sx?$/,
13+
babelConfig: {
14+
presets: ["@babel/preset-typescript"],
15+
plugins: ["babel-plugin-react-compiler"],
16+
generatorOpts: {
17+
compact: true, // silence file size warns
18+
},
19+
},
20+
}),
21+
],
822
test: {
923
environment: "jsdom",
1024
globals: true,

0 commit comments

Comments
 (0)