From 066bb4e83d82ccfd4557ca58780c49c8a4c4bfb2 Mon Sep 17 00:00:00 2001 From: ZhenYi <434836402@qq.com> Date: Tue, 12 May 2026 22:41:44 +0800 Subject: [PATCH] fix(react): add resolve.dedupe for react/react-dom to prevent CJS multi-instance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit React 19.2.5 is pure CJS. Rollup's CJS→ESM interop can create separate scoped ReactSharedInternals objects for react and react-dom, causing hooks to see a null dispatcher on the server build. resolve.dedupe forces a single shared instance. --- vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.ts b/vite.config.ts index 84f2981..2a9d670 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -24,6 +24,7 @@ export default defineConfig({ alias: { "@": path.resolve(__dirname, "./src"), }, + dedupe: ["react", "react-dom"], }, server: { host: true,