feat: `process.env.DIST`, `process.env.PUBLIC`
This commit is contained in:
parent
68a41e3b5a
commit
cac23a138c
|
@ -14,24 +14,19 @@ if (!app.requestSingleInstanceLock()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
|
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
|
||||||
|
process.env.DIST = join(__dirname, '../..')
|
||||||
export const ROOT_PATH = {
|
process.env.PUBLIC = app.isPackaged ? process.env.DIST : join(process.env.DIST, '../public')
|
||||||
// /dist
|
|
||||||
dist: join(__dirname, '../..'),
|
|
||||||
// /dist or /public
|
|
||||||
public: join(__dirname, app.isPackaged ? '../..' : '../../../public'),
|
|
||||||
}
|
|
||||||
|
|
||||||
let win: BrowserWindow | null = null
|
let win: BrowserWindow | null = null
|
||||||
// Here, you can also use other preload
|
// Here, you can also use other preload
|
||||||
const preload = join(__dirname, '../preload/index.js')
|
const preload = join(__dirname, '../preload/index.js')
|
||||||
const url = process.env.VITE_DEV_SERVER_URL
|
const url = process.env.VITE_DEV_SERVER_URL
|
||||||
const indexHtml = join(ROOT_PATH.dist, 'index.html')
|
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(ROOT_PATH.public, 'favicon.svg'),
|
icon: join(process.env.PUBLIC, 'favicon.svg'),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload,
|
preload,
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
|
Loading…
Reference in New Issue