Skip to content

Commit a14be45

Browse files
committed
chore(playground): add React Compiler
1 parent bbd6328 commit a14be45

4 files changed

Lines changed: 232 additions & 137 deletions

File tree

playground/eslint.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import js from '@eslint/js';
2+
import reactCompiler from 'eslint-plugin-react-compiler';
23
import reactHooks from 'eslint-plugin-react-hooks';
34
import reactRefresh from 'eslint-plugin-react-refresh';
45
import globals from 'globals';
@@ -24,5 +25,6 @@ export default tseslint.config(
2425
{ allowConstantExport: true },
2526
],
2627
},
27-
}
28+
},
29+
reactCompiler.configs.recommended
2830
);

playground/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
"@faker-js/faker": "^10.2.0",
2727
"@types/react": "^19.0.9",
2828
"@types/react-dom": "^19.0.3",
29-
"@vitejs/plugin-react-swc": "^3.11.0",
29+
"@vitejs/plugin-react": "^5.1.2",
30+
"babel-plugin-react-compiler": "^1.0.0",
3031
"dotenv": "^16.4.5",
3132
"dotenv-expand": "^10.0.0",
3233
"eslint": "^9.39.1",
3334
"eslint-plugin-react": "^7.37.5",
35+
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
3436
"eslint-plugin-react-hooks": "^7.0.1",
3537
"eslint-plugin-react-refresh": "^0.4.24",
3638
"globals": "^16.5.0",

playground/vite.config.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react-swc'
1+
import react from '@vitejs/plugin-react';
2+
import { defineConfig } from 'vite';
33

4-
// https://vite.dev/config/
54
export default defineConfig({
6-
plugins: [react()],
7-
})
5+
plugins: [
6+
react({
7+
babel: {
8+
plugins: [
9+
[
10+
'babel-plugin-react-compiler',
11+
{
12+
panicThreshold: 'all_errors',
13+
},
14+
],
15+
],
16+
},
17+
}),
18+
],
19+
build: {
20+
minify: false,
21+
},
22+
});

0 commit comments

Comments
 (0)