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(dev): give each checkout its own vite dependency cache

Etienne Lescotccf4879fb8c5
diff --git a/.gitignore b/.gitignore
index 41a967b8f..ea760a81b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,6 +76,11 @@ result-*
# Build cache for the native STT server (FetchContent clones + CMake build).
/.cache/
+# Vite's dependency cache, moved out of node_modules so concurrent dev servers
+# (main checkout + worktrees, which share node_modules via a junction) stop
+# re-optimising into each other's cache. See `cacheDir` in vite.config.ts.
+/.vite-cache/
+
# whisper.cpp DTW POC (tools/stt-eval/whispercpp-dtw-poc) — vendored engine
# clone, downloaded GGML models, and generated build/results artifacts.
# See docs/engineering/stt-whispercpp-dtw-poc-plan.md.
diff --git a/vite.config.ts b/vite.config.ts
index 621325613..a42dab288 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -5,6 +5,18 @@ import electron from "vite-plugin-electron/simple";
// https://vitejs.dev/config/
export default defineConfig({
+ // Vite's dependency cache defaults to `node_modules/.vite`, and in this repo every
+ // worktree's `node_modules` is a JUNCTION to the main checkout's — so the main repo
+ // and every worktree share ONE cache directory. Running two dev servers at once
+ // (routine here) then has them re-optimising into each other's cache: the second run
+ // rewrites `deps/` while the first has already handed the browser URLs stamped with
+ // the previous `?v=` token, so the renderer ends up holding two generations of the
+ // same dependency at once — "Invalid hook call / more than one copy of React",
+ // `useState` null, blank editor. Same symptom as the `dedupe` note below, different
+ // cause: that one is about resolution, this one about a cache with several writers.
+ // Keeping the cache beside the checkout that owns it (NOT under `node_modules`, which
+ // is the junction) makes concurrent servers independent.
+ cacheDir: path.resolve(__dirname, ".vite-cache"),
plugins: [
react(),
electron({