mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-08-29 05:04:47 +08:00
v2.1.0: use vite-electron-plugin
instead vite-plugin-electron
This commit is contained in:
19
electron/electron-env.d.ts
vendored
19
electron/electron-env.d.ts
vendored
@@ -1,22 +1,9 @@
|
||||
/// <reference types="vite-plugin-electron/electron-env" />
|
||||
/// <reference types="vite-electron-plugin/electron-env" />
|
||||
|
||||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
/**
|
||||
* The built directory structure
|
||||
*
|
||||
* ```tree
|
||||
* ├─┬ dist
|
||||
* │ ├─┬ electron
|
||||
* │ │ ├─┬ main
|
||||
* │ │ │ └── index.js
|
||||
* │ │ └─┬ preload
|
||||
* │ │ └── index.js
|
||||
* │ ├── index.html
|
||||
* │ ├── ...other-static-files-from-public
|
||||
* │
|
||||
* ```
|
||||
*/
|
||||
VSCODE_DEBUG?: 'true'
|
||||
DIST_ELECTRON: string
|
||||
DIST: string
|
||||
/** /dist/ or /public/ */
|
||||
PUBLIC: string
|
||||
|
@@ -1,16 +1,16 @@
|
||||
// The built directory structure
|
||||
//
|
||||
// ├─┬ dist-electron
|
||||
// │ ├─┬ main
|
||||
// │ │ └── index.js > Electron-Main
|
||||
// │ └─┬ preload
|
||||
// │ └── index.js > Preload-Scripts
|
||||
// ├─┬ dist
|
||||
// │ ├─┬ electron
|
||||
// │ │ ├─┬ main
|
||||
// │ │ │ └── index.js
|
||||
// │ │ └─┬ preload
|
||||
// │ │ └── index.js
|
||||
// │ ├── index.html
|
||||
// │ ├── ...other-static-files-from-public
|
||||
// │
|
||||
process.env.DIST = join(__dirname, '../..')
|
||||
process.env.PUBLIC = app.isPackaged ? process.env.DIST : join(process.env.DIST, '../public')
|
||||
// │ └── index.html > Electron-Renderer
|
||||
//
|
||||
process.env.DIST_ELECTRON = join(__dirname, '..')
|
||||
process.env.DIST = join(process.env.DIST_ELECTRON, '../dist')
|
||||
process.env.PUBLIC = app.isPackaged ? process.env.DIST : join(process.env.DIST_ELECTRON, '../public')
|
||||
|
||||
import { app, BrowserWindow, shell, ipcMain } from 'electron'
|
||||
import { release } from 'os'
|
||||
@@ -35,7 +35,7 @@ if (!app.requestSingleInstanceLock()) {
|
||||
let win: BrowserWindow | null = null
|
||||
// Here, you can also use other preload
|
||||
const preload = join(__dirname, '../preload/index.js')
|
||||
const url = process.env.VITE_DEV_SERVER_URL as string
|
||||
const url = process.env.VITE_DEV_SERVER_URL
|
||||
const indexHtml = join(process.env.DIST, 'index.html')
|
||||
|
||||
async function createWindow() {
|
||||
|
Reference in New Issue
Block a user