Skip to content

Commit 26b3991

Browse files
committed
fix!: remove resolve.dedupe
1 parent 1b4e0f0 commit 26b3991

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/plugin-react/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Unreleased
44

5+
### `react` and `react-dom` is no longer added to [`resolve.dedupe`](https://vite.dev/config/#resolve-dedupe) automatically
6+
7+
Adding values to `resolve.dedupe` will force Vite to resolve them in a different way than Node.js does, which is confusing and may not be expected. This plugin no longer adds `react` and `react-dom` to `resolve.dedupe` automatically.
8+
9+
If you encounter an error after upgrading, check the `dependencies` / `devDependencies` in `package.json` and the package manager's configuration. If you want the previous behavior, you can add `react` and `react-dom` to `resolve.dedupe` manually.
10+
511
## 4.7.0 (2025-07-18)
612

713
### Add HMR support for compound components ([#518](https://github.com/vitejs/vite-plugin-react/pull/518))

packages/plugin-react/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,6 @@ export default function viteReact(opts: Options = {}): Plugin[] {
364364
optimizeDeps: {
365365
include: dependencies,
366366
},
367-
resolve: {
368-
dedupe: ['react', 'react-dom'],
369-
},
370367
}),
371368
resolveId: {
372369
filter: { id: exactRegex(runtimePublicPath) },

0 commit comments

Comments
 (0)