fix: use VITE_DEV_SERVER_URL instead `app.isPackaged`

This commit is contained in:
草鞋没号 2022-11-06 18:07:09 +08:00
parent c711938f70
commit a82f0828a8
1 changed files with 5 additions and 4 deletions

View File

@ -44,11 +44,12 @@ async function createWindow() {
}, },
}) })
if (app.isPackaged) { if (process.env.VITE_DEV_SERVER_URL) { // electron-vite-vue#298
win.loadFile(indexHtml)
} else {
win.loadURL(url) 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 // Test actively push message to the Electron-Renderer