mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
`npm run tauri dev` died on Windows partway through the cargo build:
Error: EBUSY: resource busy or locked, watch
'src-tauri\target\debug\deps\owncord_client_lib.dll'
Error The "beforeDevCommand" terminated with a non-zero status code.
Vite's watcher recursed into `src-tauri/target/`, and the moment cargo
wrote the output DLL, node's FSWatcher raised EBUSY as an unhandled
error event and killed the vite process. Vite is tauri's
`beforeDevCommand`, so its death aborted the whole dev session.
The config matched the upstream Tauri vite template in every respect
except the `server.watch.ignored` block that template ships with. Add
it. Tauri already watches `src-tauri` itself for rebuilds, so nothing
is lost.
Windows-specific — EBUSY on an open handle is a Windows filesystem
semantic, and CI only ever runs `tauri build`, never `tauri dev`, so
neither caught it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import { defineConfig, type Plugin } from "vite";
|
|
import { resolve } from "path";
|
|
|
|
const host = process.env.TAURI_DEV_HOST;
|
|
|
|
/** Strip crossorigin attributes — Tauri serves via custom protocol. */
|
|
function stripCrossOrigin(): Plugin {
|
|
return {
|
|
name: "strip-crossorigin",
|
|
transformIndexHtml(html) {
|
|
return html.replace(/\s+crossorigin/g, "");
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [stripCrossOrigin()],
|
|
build: {
|
|
modulePreload: { polyfill: false },
|
|
cssCodeSplit: false,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
// Keep the ~1.3 MB LiveKit SDK in its own chunk, out of the entry.
|
|
livekit: ["livekit-client"],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@lib": resolve(__dirname, "src/lib"),
|
|
"@stores": resolve(__dirname, "src/stores"),
|
|
"@components": resolve(__dirname, "src/components"),
|
|
"@pages": resolve(__dirname, "src/pages"),
|
|
"@styles": resolve(__dirname, "src/styles"),
|
|
},
|
|
},
|
|
clearScreen: false,
|
|
server: {
|
|
port: 1420,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host ? { protocol: "ws", host, port: 1421 } : undefined,
|
|
watch: {
|
|
// Never watch the Rust tree. `tauri dev` runs Vite as its
|
|
// `beforeDevCommand`, so without this the watcher picks up
|
|
// `src-tauri/target/` and dies with EBUSY the moment cargo writes the
|
|
// output DLL on Windows — taking the whole dev session with it. Tauri
|
|
// already watches `src-tauri` itself for rebuilds.
|
|
ignored: ["**/src-tauri/**"],
|
|
},
|
|
},
|
|
});
|