-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e636b5d
commit 59d3d33
Showing
2 changed files
with
10 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
import { app, BrowserWindow } from 'electron' | ||
import path from 'node:path' | ||
|
||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin - [email protected] | ||
const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL'] | ||
|
||
// The built directory structure | ||
// | ||
// ├─┬─┬ dist | ||
|
@@ -13,10 +10,14 @@ const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL'] | |
// │ │ ├── main.js | ||
// │ │ └── preload.js | ||
// │ | ||
process.env.DIST = path.join(__dirname, '../dist') | ||
process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL | ||
? path.join(process.env.DIST, '../public') | ||
: process.env.DIST | ||
process.env.APP_ROOT = path.join(__dirname, '..') | ||
|
||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin - [email protected] | ||
export const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL'] | ||
export const MAIN_DIST = path.join(process.env.APP_ROOT, 'dist-electron') | ||
export const RENDERER_DIST = path.join(process.env.APP_ROOT, 'dist') | ||
|
||
process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT, 'public') : RENDERER_DIST | ||
|
||
let win: BrowserWindow | null | ||
|
||
|
@@ -37,7 +38,7 @@ function createWindow() { | |
win.loadURL(VITE_DEV_SERVER_URL) | ||
} else { | ||
// win.loadFile('dist/index.html') | ||
win.loadFile(path.join(process.env.DIST, 'index.html')) | ||
win.loadFile(path.join(RENDERER_DIST, 'index.html')) | ||
} | ||
} | ||
|
||
|