mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 03:46:35 +08:00
fix: Rename PUBLIC environment variable to avoid problems with child_process
This commit is contained in:
parent
36ae4e4421
commit
72a74b89d8
2
electron/electron-env.d.ts
vendored
2
electron/electron-env.d.ts
vendored
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user