fix: Rename PUBLIC environment variable to avoid problems with child_process

This commit is contained in:
草鞋没号 2023-08-04 11:27:49 +08:00
parent 36ae4e4421
commit 72a74b89d8
2 changed files with 3 additions and 3 deletions

View File

@ -6,6 +6,6 @@ declare namespace NodeJS {
DIST_ELECTRON: string DIST_ELECTRON: string
DIST: string DIST: string
/** /dist/ or /public/ */ /** /dist/ or /public/ */
PUBLIC: string VITE_PUBLIC: string
} }
} }

View File

@ -14,7 +14,7 @@ import { join } from 'node:path'
// //
process.env.DIST_ELECTRON = join(__dirname, '..') process.env.DIST_ELECTRON = join(__dirname, '..')
process.env.DIST = join(process.env.DIST_ELECTRON, '../dist') 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') ? join(process.env.DIST_ELECTRON, '../public')
: process.env.DIST : process.env.DIST
@ -43,7 +43,7 @@ const indexHtml = join(process.env.DIST, 'index.html')
async function createWindow() { async function createWindow() {
win = new BrowserWindow({ win = new BrowserWindow({
title: 'Main window', title: 'Main window',
icon: join(process.env.PUBLIC, 'favicon.ico'), icon: join(process.env.VITE_PUBLIC, 'favicon.ico'),
webPreferences: { webPreferences: {
preload, preload,
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production // Warning: Enable nodeIntegration and disable contextIsolation is not secure in production