diff --git a/electron/main.cjs b/electron/main.cjs index d7c0f05..1273f91 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -34,7 +34,7 @@ function createWindow() { }) if (isDev) { - win.loadURL('http://localhost:5173') + win.loadURL('http://127.0.0.1:5173') win.webContents.openDevTools() } else { win.loadFile(path.join(__dirname, '../dist/index.html')) diff --git a/package.json b/package.json index fae472b..4d11ccf 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dev": "vite", "build": "vite build", "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:win": "vite build && electron-builder --win --publish never", "electron:build:mac": "vite build && electron-builder --mac --publish never", diff --git a/vite.config.js b/vite.config.js index beb4b29..39e3646 100644 --- a/vite.config.js +++ b/vite.config.js @@ -6,6 +6,9 @@ export default defineConfig({ plugins: [react(), tailwindcss()], base: './', // relative paths so Electron can load files from disk 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, }, build: {