From a82f0828a867f63ef074ceb24138ad25b468bf16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Sun, 6 Nov 2022 18:07:09 +0800 Subject: [PATCH] fix: use VITE_DEV_SERVER_URL instead `app.isPackaged` --- electron/main/index.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 48cff1f..f45bd76 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -44,11 +44,12 @@ async function createWindow() { }, }) - if (app.isPackaged) { - win.loadFile(indexHtml) - } else { + if (process.env.VITE_DEV_SERVER_URL) { // electron-vite-vue#298 win.loadURL(url) - // win.webContents.openDevTools() + // Open devTool if the app is not packaged + win.webContents.openDevTools() + } else { + win.loadFile(indexHtml) } // Test actively push message to the Electron-Renderer