diff --git a/crates/tauri-app/src-tauri/tauri.conf.json b/crates/tauri-app/src-tauri/tauri.conf.json index ebef902..98c2c19 100644 --- a/crates/tauri-app/src-tauri/tauri.conf.json +++ b/crates/tauri-app/src-tauri/tauri.conf.json @@ -5,7 +5,7 @@ "identifier": "de.eifelcloud.maarcadetweet", "build": { "beforeDevCommand": "npm run dev", - "devUrl": "http://localhost:1430", + "devUrl": "http://127.0.0.1:1430", "beforeBuildCommand": "npm run build", "frontendDist": "../dist" }, diff --git a/crates/tauri-app/vite.config.ts b/crates/tauri-app/vite.config.ts index 3d2c1c7..c4d6b95 100644 --- a/crates/tauri-app/vite.config.ts +++ b/crates/tauri-app/vite.config.ts @@ -17,7 +17,16 @@ export default defineConfig(async () => ({ server: { port: 1430, strictPort: true, - host: host || false, + // Always bind to IPv4 127.0.0.1 explicitly. `host || false` lets + // vite pick "localhost" which on macOS resolves to both v4 and v6 + // and binds to v6 by default — the Tauri webview then tries v4 + // first and gets a connection refused. The explicit v4 address + // matches `tauri.conf.json`'s `devUrl` so the webview connects + // reliably. HMR via Tauri (cross-platform) still works because + // vite binds both v4 and v6 in modern versions when the address + // is the v4 loopback; if that breaks for someone we can use + // `0.0.0.0` to listen on all interfaces instead. + host: host || "127.0.0.1", hmr: host ? { protocol: "ws", host, port: 1431 } : undefined,