mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
feat: Allow use import.meta.env.VITE_SOME_KEY
in Electron-Main
This commit is contained in:
parent
b2ef751ada
commit
2512ad1652
@ -2,7 +2,7 @@ import { rmSync } from 'fs'
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import electron from 'vite-electron-plugin'
|
import electron from 'vite-electron-plugin'
|
||||||
import { customStart } from 'vite-electron-plugin/plugin'
|
import { customStart, loadViteEnv } from 'vite-electron-plugin/plugin'
|
||||||
import renderer from 'vite-plugin-electron-renderer'
|
import renderer from 'vite-plugin-electron-renderer'
|
||||||
import pkg from './package.json'
|
import pkg from './package.json'
|
||||||
|
|
||||||
@ -17,10 +17,16 @@ export default defineConfig({
|
|||||||
transformOptions: {
|
transformOptions: {
|
||||||
sourcemap: !!process.env.VSCODE_DEBUG,
|
sourcemap: !!process.env.VSCODE_DEBUG,
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
...(process.env.VSCODE_DEBUG
|
||||||
|
? [
|
||||||
// Will start Electron via VSCode Debug
|
// Will start Electron via VSCode Debug
|
||||||
plugins: process.env.VSCODE_DEBUG
|
customStart(debounce(() => console.log(/* For `.vscode/.debug.script.mjs` */'[startup] Electron App'))),
|
||||||
? [customStart(debounce(() => console.log(/* For `.vscode/.debug.script.mjs` */'[startup] Electron App')))]
|
]
|
||||||
: undefined,
|
: []),
|
||||||
|
// Allow use `import.meta.env.VITE_SOME_KEY` in Electron-Main
|
||||||
|
loadViteEnv(),
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
// Use Node.js API in the Renderer-process
|
// Use Node.js API in the Renderer-process
|
||||||
renderer({
|
renderer({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user