-
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.
Merge pull request #38 from electron-vite/v0.6.0
V0.6.0
- Loading branch information
Showing
6 changed files
with
22 additions
and
11 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
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 |
---|---|---|
|
@@ -10,13 +10,16 @@ import path from 'node:path' | |
// │ │ ├── main.js | ||
// │ │ └── preload.js | ||
// │ | ||
process.env.DIST = path.join(__dirname, '../dist') | ||
process.env.VITE_PUBLIC = app.isPackaged ? process.env.DIST : path.join(process.env.DIST, '../public') | ||
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 | ||
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin - [email protected] | ||
const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL'] | ||
|
||
function createWindow() { | ||
win = new BrowserWindow({ | ||
|
@@ -35,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')) | ||
} | ||
} | ||
|
||
|
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