Skip to content

Commit 142fdd8

Browse files
committed
[code-infra] Setup react-compiler
Enabled for both linting and building packages
1 parent ad0190c commit 142fdd8

File tree

7 files changed

+51
-8
lines changed

7 files changed

+51
-8
lines changed

babel.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ export default function getBabelConfig(api) {
1919
errorCodesPath,
2020
},
2121
],
22+
[
23+
'babel-plugin-react-compiler',
24+
/** @type {import('babel-plugin-react-compiler').PluginOptions} */ ({
25+
compilationMode: 'infer',
26+
// When targeting react v17 or v18, the packages also need to have
27+
// "react-compiler-runtime" as a dependency.
28+
target: '17',
29+
enableReanimatedCheck: false,
30+
}),
31+
],
2232
];
2333

2434
return {

docs/next.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const nextConfig = {
5757
},
5858
...(process.env.NODE_ENV === 'production' && { distDir: 'export', output: 'export' }),
5959
devIndicators: false,
60+
experimental: {
61+
reactCompiler: true,
62+
},
6063
};
6164

6265
const mergedConfig = withMdx(withDeploymentConfig(nextConfig));

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default defineConfig(
3434
globalIgnores(['./examples']),
3535
createBaseConfig({
3636
baseDirectory: dirname,
37+
enableReactCompiler: true,
3738
}),
3839
{
3940
name: 'Base UI overrides',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"@vitest/coverage-istanbul": "3.2.4",
7474
"@vitest/ui": "3.2.4",
7575
"@vvago/vale": "^3.12.0",
76+
"babel-plugin-react-compiler": "1.0.0",
7677
"chai-dom": "^1.12.1",
7778
"chalk": "^5.6.2",
7879
"concurrently": "^9.2.1",

packages/react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"@base-ui-components/utils": "workspace:*",
8989
"@floating-ui/react-dom": "^2.1.6",
9090
"@floating-ui/utils": "^0.2.10",
91+
"react-compiler-runtime": "^1.0.0",
9192
"reselect": "^5.1.1",
9293
"tabbable": "^6.2.0",
9394
"use-sync-external-store": "^1.6.0"

packages/utils/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"dependencies": {
2929
"@babel/runtime": "^7.28.4",
3030
"@floating-ui/utils": "^0.2.10",
31+
"react-compiler-runtime": "^1.0.0",
3132
"reselect": "^5.1.1",
3233
"use-sync-external-store": "^1.6.0"
3334
},

pnpm-lock.yaml

Lines changed: 34 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)