Skip to content

Commit e8a923f

Browse files
authored
fix: add react-dom in optimizeOps to handle CJS script. (#375)
1 parent 7a7e339 commit e8a923f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/plugin-react/src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,12 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
269269
},
270270
}
271271

272-
// We can't add `react-dom` because the dependency is `react-dom/client`
273-
// for React 18 while it's `react-dom` for React 17. We'd need to detect
274-
// what React version the user has installed.
275-
const dependencies = ['react', jsxImportDevRuntime, jsxImportRuntime]
272+
const dependencies = [
273+
'react',
274+
'react-dom',
275+
jsxImportDevRuntime,
276+
jsxImportRuntime,
277+
]
276278
const staticBabelPlugins =
277279
typeof opts.babel === 'object' ? opts.babel?.plugins ?? [] : []
278280
const reactCompilerPlugin = getReactCompilerPlugin(staticBabelPlugins)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy