You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/plugin-react-swc/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
## Unreleased
4
4
5
+
### Suggest `@vitejs/plugin-react-oxc` if rolldown-vite is detected [#491](https://github.com/vitejs/vite-plugin-react/pull/491)
6
+
7
+
Emit a log which recommends `@vitejs/plugin-react-oxc` when `rolldown-vite` is detected to improve performance and use Oxc under the hood. The warning can be disabled by setting `disableOxcRecommendation: false` in the plugin options.
8
+
5
9
### Use `optimizeDeps.rollupOptions` instead of `optimizeDeps.esbuildOptions` for rolldown-vite [#489](https://github.com/vitejs/vite-plugin-react/pull/489)
6
10
7
11
This suppresses the warning about `optimizeDeps.esbuildOptions` being deprecated in rolldown-vite.
Copy file name to clipboardExpand all lines: packages/plugin-react-swc/README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,14 @@ react({
117
117
})
118
118
```
119
119
120
+
### disableOxcRecommendation
121
+
122
+
If set, disables the recommendation to use `@vitejs/plugin-react-oxc` (which is shown when `rolldown-vite` is detected and neither `swc` plugins are used nor the `swc` options are mutated).
123
+
124
+
```ts
125
+
react({ disableOxcRecommendation: true })
126
+
```
127
+
120
128
## Consistent components exports
121
129
122
130
For React refresh to work correctly, your file should only export React components. The best explanation I've read is the one from the [Gatsby docs](https://www.gatsbyjs.com/docs/reference/local-development/fast-refresh/#how-it-works).
'[vite:react-swc] The MDX plugin should be placed before this plugin',
145
151
)
146
152
}
153
+
154
+
if(
155
+
'rolldownVersion'invite&&
156
+
!options.plugins&&
157
+
!options.useAtYourOwnRisk_mutateSwcOptions&&
158
+
!options.disableOxcRecommendation
159
+
){
160
+
config.logger.warn(
161
+
'[vite:react-swc] We recommend switching to `@vitejs/plugin-react-oxc` for improved performance as no swc plugins are used. More information at https://vite.dev/rolldown',
Copy file name to clipboardExpand all lines: packages/plugin-react/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,11 @@
2
2
3
3
## Unreleased
4
4
5
+
### Suggest `@vitejs/plugin-react-oxc` if rolldown-vite is detected [#491](https://github.com/vitejs/vite-plugin-react/pull/491)
6
+
7
+
Emit a log which recommends `@vitejs/plugin-react-oxc` when `rolldown-vite` is detected to improve performance and use Oxc under the hood. The warning can be disabled by setting `disableOxcRecommendation: false` in the plugin options.
8
+
9
+
5
10
### Use `optimizeDeps.rollupOptions` instead of `optimizeDeps.esbuildOptions` for rolldown-vite [#489](https://github.com/vitejs/vite-plugin-react/pull/489)
6
11
7
12
This suppresses the warning about `optimizeDeps.esbuildOptions` being deprecated in rolldown-vite.
Copy file name to clipboardExpand all lines: packages/plugin-react/README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,10 @@ Otherwise, you'll probably get this error:
129
129
Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong.
130
130
```
131
131
132
+
### disableOxcRecommendation
133
+
134
+
If set, disables the recommendation to use `@vitejs/plugin-react-oxc` (which is shown when `rolldown-vite` is detected and `babel` is not configured).
135
+
132
136
## Consistent components exports
133
137
134
138
For React refresh to work correctly, your file should only export React components. You can find a good explanation in the [Gatsby docs](https://www.gatsbyjs.com/docs/reference/local-development/fast-refresh/#how-it-works).
0 commit comments