From c43f6484b9affac3bcc252e7ea14dab29c6478ab 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: Tue, 22 Nov 2022 08:14:27 +0800 Subject: [PATCH] chore: VITE_DEV_SERVER_URL instead `app.isPackaged` --- electron/main/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index bab5a59..be0fcf5 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -96,7 +96,7 @@ app.on('activate', () => { } }) -// new window example arg: new windows url +// New window example arg: new windows url ipcMain.handle('open-win', (event, arg) => { const childWindow = new BrowserWindow({ webPreferences: { @@ -106,10 +106,9 @@ ipcMain.handle('open-win', (event, arg) => { }, }) - if (app.isPackaged) { - childWindow.loadFile(indexHtml, { hash: arg }) - } else { + if (process.env.VITE_DEV_SERVER_URL) { childWindow.loadURL(`${url}#${arg}`) - // childWindow.webContents.openDevTools({ mode: "undocked", activate: true }) + } else { + childWindow.loadFile(indexHtml, { hash: arg }) } })