We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
react
optimizeDeps
1 parent eec3886 commit bc4a627Copy full SHA for bc4a627
packages/plugin-react/src/index.ts
@@ -406,7 +406,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
406
config() {
407
return {
408
optimizeDeps: {
409
- include: [reactJsxRuntimeId, reactJsxDevRuntimeId]
+ // We can't add `react-dom` because the dependency is `react-dom/client`
410
+ // for React 18 while it's `react-dom` for React 17. We'd need to detect
411
+ // what React version the user has installed.
412
+ include: [reactJsxRuntimeId, reactJsxDevRuntimeId, 'react']
413
}
414
415
},
0 commit comments