diff --git a/electron/electron-env.d.ts b/electron/electron-env.d.ts index d02e86c..b4c4211 100644 --- a/electron/electron-env.d.ts +++ b/electron/electron-env.d.ts @@ -6,6 +6,6 @@ declare namespace NodeJS { DIST_ELECTRON: string DIST: string /** /dist/ or /public/ */ - PUBLIC: string + VITE_PUBLIC: string } } diff --git a/electron/main/index.ts b/electron/main/index.ts index a1bed6c..ccee8e4 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -14,7 +14,7 @@ import { join } from 'node:path' // process.env.DIST_ELECTRON = join(__dirname, '..') process.env.DIST = join(process.env.DIST_ELECTRON, '../dist') -process.env.PUBLIC = process.env.VITE_DEV_SERVER_URL +process.env.VITE_PUBLIC = process.env.VITE_DEV_SERVER_URL ? join(process.env.DIST_ELECTRON, '../public') : process.env.DIST @@ -43,7 +43,7 @@ const indexHtml = join(process.env.DIST, 'index.html') async function createWindow() { win = new BrowserWindow({ title: 'Main window', - icon: join(process.env.PUBLIC, 'favicon.ico'), + icon: join(process.env.VITE_PUBLIC, 'favicon.ico'), webPreferences: { preload, // Warning: Enable nodeIntegration and disable contextIsolation is not secure in production