Skip to content

Commit

Permalink
fix: add react and vue to optimizeDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jul 12, 2022
1 parent f020066 commit f17d14b
Show file tree
Hide file tree
Showing 2 changed files with 7 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. Can we do this?
include: [reactJsxRuntimeId, reactJsxDevRuntimeId, 'react']
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-vue/src/index.ts
Expand Up @@ -125,6 +125,9 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
},
ssr: {
external: ['vue', '@vue/server-renderer']
},
optimizeDeps: {
include: ['vue']
}
}
},
Expand Down

0 comments on commit f17d14b

Please sign in to comment.