Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(vite): dedupe react so the app runs from a git worktree

Etienne Lescotf04882bd3d53
diff --git a/vite.config.ts b/vite.config.ts
index 0e1985f8d..621325613 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -33,6 +33,14 @@ export default defineConfig({
alias: {
"@": path.resolve(__dirname, "src"),
},
+ // This checkout is a git worktree nested under the main repo, and its
+ // node_modules is incomplete (e.g. zustand is absent), so bare deps that
+ // aren't present here resolve UP into the main repo's node_modules and drag
+ // in a SECOND copy of React — "Invalid hook call / more than one copy of
+ // React" → blank editor. Force every importer (app + hoisted deps like
+ // zustand) onto this checkout's single React copy. Harmless in a normal
+ // full install (already a single copy there); required to run from a worktree.
+ dedupe: ["react", "react-dom", "react/jsx-runtime"],
},
server: {
watch: {