refactor: better scripts and vite-config

This commit is contained in:
草鞋没号 committed 2022-02-08 09:59:56 +08:00
1 parent 7aa3614676
commit 2fed75baf0
5 files changed
+53 -61

No files matched your search

+3 -3
View File
@@ -27,14 +27,14 @@ async function createWindow() {
if (app.isPackaged) {
win.loadFile(join(__dirname, '../renderer/index.html'))
} else {
const pkg = await import('../../package.json')
const url = `http://${pkg.env.HOST || '127.0.0.1'}:${pkg.env.PORT}`
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin
const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}`
win.loadURL(url)
win.webContents.openDevTools()
}
// Test active push message to Renderer-process.
// Test active push message to Renderer-process
win.webContents.on('did-finish-load', () => {
win?.webContents.send('main-process-message', (new Date).toLocaleString())
})