Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/plugin-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ The `reactCompilerPreset` accepts an optional options object with the following
- `compilationMode` — Set to `'annotation'` to only compile components annotated with `"use memo"`.
- `target` — Set to `'17'` or `'18'` to target older React versions (uses `react-compiler-runtime` instead of `react/compiler-runtime`).

Additional options can be found in the [documentation](https://react.dev/reference/react-compiler/configuration).

```js
babel({
presets: [reactCompilerPreset({ compilationMode: 'annotation' })],
Expand Down
5 changes: 1 addition & 4 deletions packages/plugin-react/src/reactCompilerPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import type {
} from '#optionalTypes'

export const reactCompilerPreset = (
options: Pick<
ReactCompilerBabelPluginOptions,
'compilationMode' | 'target'
> = {},
options: ReactCompilerBabelPluginOptions = {},
): RolldownBabelPreset => ({
preset: () => ({
plugins: [['babel-plugin-react-compiler', options]],
Expand Down
Loading