vite: bind the dev server to 127.0.0.1, where the app's WebView looks
Vite 6 on modern Node binds [::1] alone when no host is set, while WebView2 resolves the devUrl's "localhost" to IPv4 — the window opens on ERR_CONNECTION_REFUSED while curl and every browser say the server is fine.
This commit is contained in:
1 parent
185c29fc33
commit
4b30c5e573
1 file changed
+5
@@ -7,6 +7,11 @@ export default defineConfig({
|
|||||||
server: {
|
server: {
|
||||||
port: 1421,
|
port: 1421,
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
|
// Bind IPv4 loopback explicitly. With no host, Vite on modern Node
|
||||||
|
// binds [::1] ONLY, while WebView2 resolves the devUrl's "localhost"
|
||||||
|
// to 127.0.0.1 — so the window opens on ERR_CONNECTION_REFUSED while
|
||||||
|
// curl and the browser (which try ::1) both say the server is fine.
|
||||||
|
host: "127.0.0.1",
|
||||||
watch: {
|
watch: {
|
||||||
// Never watch the Rust build dir: cargo locks files mid-compile,
|
// Never watch the Rust build dir: cargo locks files mid-compile,
|
||||||
// which crashes Vite's watcher (EBUSY) and kills tauri dev.
|
// which crashes Vite's watcher (EBUSY) and kills tauri dev.
|
||||||
|
|||||||
Reference in new issue
Block a user