Skip to content

Commit

Permalink
fix: add react to optimizeDeps (#9056)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Aug 19, 2022
1 parent eec3886 commit bc4a627
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/plugin-react/src/index.ts
Expand Up @@ -406,7 +406,10 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
config() {
return {
optimizeDeps: {
include: [reactJsxRuntimeId, reactJsxDevRuntimeId]
// We can't add `react-dom` because the dependency is `react-dom/client`
// for React 18 while it's `react-dom` for React 17. We'd need to detect
// what React version the user has installed.
include: [reactJsxRuntimeId, reactJsxDevRuntimeId, 'react']
}
}
},
Expand Down

0 comments on commit bc4a627

Please sign in to comment.