Skip to content

Commit c2eba54

Browse files
authored
fix: keep the Vite dev watcher out of src-tauri (#1646)
`tauri dev` starts Vite as its beforeDevCommand and then runs cargo in the same tree, so the watcher crawled src-tauri/target while cargo was writing into it. On Windows that threw an unhandled EBUSY from chokidar and killed the dev server, surfacing only as "beforeDevCommand terminated with a non-zero status code". Nothing under src-tauri feeds the frontend bundle, and on Linux this also stops ~95k build artifacts from consuming inotify watches.
1 parent 9358c91 commit c2eba54

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

apps/geolibre-desktop/vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,20 @@ export default defineConfig({
901901
server: {
902902
port: 5173,
903903
strictPort: true,
904+
watch: {
905+
// Never watch the Rust side. `tauri dev` runs this dev server as its
906+
// `beforeDevCommand` and then starts cargo in the same tree, so the
907+
// watcher would otherwise crawl `src-tauri/target/` while cargo is
908+
// writing into it. On Windows that is fatal: chokidar's fs.watch on a
909+
// build artifact cargo still holds open throws EBUSY (`errno -4082`) out
910+
// of `NodeFsHandler._addToNodeFs`, which is an unhandled error — vite
911+
// exits non-zero and tauri reports only `The "beforeDevCommand"
912+
// terminated with a non-zero status code` (see the libsqlite3-sys
913+
// `*-sqlite3.o` failure). Nothing under src-tauri feeds the frontend
914+
// bundle, so there is no HMR to lose. These are appended to Vite's own
915+
// defaults (node_modules, .git), not a replacement for them.
916+
ignored: ["**/src-tauri/**"],
917+
},
904918
},
905919
worker: {
906920
format: "es",

0 commit comments

Comments
 (0)