pack: set vite env configuration instead of use cross-env package
This commit is contained in:
1 parent
7da4d76ad8
commit
e5ae1ca0e8
3 files changed
+14
-24
No files matched your search
+12
-2
@@ -1,5 +1,5 @@
|
||||
import { fileURLToPath } from 'url'
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import ElectronPlugin, { ElectronOptions } from 'vite-plugin-electron'
|
||||
import RendererPlugin from 'vite-plugin-electron-renderer'
|
||||
import EslintPlugin from 'vite-plugin-eslint'
|
||||
@@ -12,7 +12,17 @@ import { builtinModules } from 'module'
|
||||
|
||||
const isDevEnv = process.env.NODE_ENV === 'development'
|
||||
|
||||
export default defineConfig(() => {
|
||||
export default defineConfig(({ mode }) => {
|
||||
process.env = {
|
||||
...(isDevEnv
|
||||
? {
|
||||
ELECTRON_ENABLE_LOGGING: 'true'
|
||||
}
|
||||
: {}),
|
||||
...process.env,
|
||||
...loadEnv(mode, process.cwd())
|
||||
}
|
||||
|
||||
rmSync('dist', { recursive: true, force: true })
|
||||
|
||||
const electronPluginConfigs: ElectronOptions[] = [
|
||||
|
||||
Reference in new issue
Block a user