fix(dev): pin dev server, wait-on gate, and Electron loadURL to 127.0.0.1
With plain localhost, node >=17 can bind the Vite dev server to ::1 only; on this machine IPv4/IPv6 loopback mismatch made the browser, wait-on, and the Electron window all see connection-refused while Vite reported ready. Explicit 127.0.0.1 on all three ends fixes dev startup (user-verified: electron:dev window now opens). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@ function createWindow() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
win.loadURL('http://localhost:5173')
|
win.loadURL('http://127.0.0.1:5173')
|
||||||
win.webContents.openDevTools()
|
win.webContents.openDevTools()
|
||||||
} else {
|
} else {
|
||||||
win.loadFile(path.join(__dirname, '../dist/index.html'))
|
win.loadFile(path.join(__dirname, '../dist/index.html'))
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"electron:dev": "concurrently -k \"vite\" \"wait-on http://localhost:5173 && electron .\"",
|
"electron:dev": "concurrently -k \"vite\" \"wait-on http://127.0.0.1:5173 && electron .\"",
|
||||||
"electron:build": "vite build && electron-builder",
|
"electron:build": "vite build && electron-builder",
|
||||||
"electron:build:win": "vite build && electron-builder --win --publish never",
|
"electron:build:win": "vite build && electron-builder --win --publish never",
|
||||||
"electron:build:mac": "vite build && electron-builder --mac --publish never",
|
"electron:build:mac": "vite build && electron-builder --mac --publish never",
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ export default defineConfig({
|
|||||||
plugins: [react(), tailwindcss()],
|
plugins: [react(), tailwindcss()],
|
||||||
base: './', // relative paths so Electron can load files from disk
|
base: './', // relative paths so Electron can load files from disk
|
||||||
server: {
|
server: {
|
||||||
|
// Explicit IPv4 bind: with plain `localhost`, node ≥17 can bind ::1 only,
|
||||||
|
// which browsers/wait-on may fail to reach (seen on Windows + node 24).
|
||||||
|
host: '127.0.0.1',
|
||||||
port: 5173,
|
port: 5173,
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
|||||||
Reference in New Issue
Block a user