Skip to content

Commit 66d16b3

Browse files
committed
docs: fix alternative Vite configuration for TypeScript users
1 parent 6ec6134 commit 66d16b3

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎src/content/learn/react-compiler/installation.md‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,27 @@ export default defineConfig({
108108

109109
Alternatively, you can use the Babel plugin directly with `@rolldown/plugin-babel`:
110110

111-
```js {3,9}
111+
Alternatively, you can use the Babel plugin directly with `vite-plugin-babel`:
112+
113+
```js {6,12-14}
112114
// vite.config.js
113115
import { defineConfig } from 'vite';
114116
import react from '@vitejs/plugin-react';
115-
import babel from '@rolldown/plugin-babel';
117+
import babel from 'vite-plugin-babel';
118+
119+
const ReactCompilerConfig = {}
116120

117121
export default defineConfig({
118122
plugins: [
119123
react(),
120124
babel({
121-
plugins: ['babel-plugin-react-compiler'],
125+
filter: /\.[jt]sx?$/,
126+
babelConfig: {
127+
presets: ["@babel/preset-typescript"],
128+
plugins: [
129+
["babel-plugin-react-compiler", ReactCompilerConfig],
130+
]
131+
}
122132
}),
123133
],
124134
});

0 commit comments

Comments
 (0)