From 0b265442a1d902c3fa47cc6cf83e0625ad37bb44 Mon Sep 17 00:00:00 2001 From: alex8088 <244096523@qq.com> Date: Thu, 14 Dec 2023 21:14:49 +0800 Subject: [PATCH] feat: env variables prefixed with VITE_ will be shared in main process and renderer --- src/plugins/electron.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/electron.ts b/src/plugins/electron.ts index 82bbf31..18b6897 100644 --- a/src/plugins/electron.ts +++ b/src/plugins/electron.ts @@ -117,7 +117,7 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[ config.define = config.define || {} config.define = { ...processEnvDefine(), ...config.define } - config.envPrefix = config.envPrefix || 'MAIN_VITE_' + config.envPrefix = config.envPrefix || ['MAIN_VITE_', 'VITE_'] config.publicDir = config.publicDir || 'resources' // do not copy public dir @@ -262,7 +262,7 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug config.define = config.define || {} config.define = { ...processEnvDefine(), ...config.define } - config.envPrefix = config.envPrefix || 'PRELOAD_VITE_' + config.envPrefix = config.envPrefix || ['PRELOAD_VITE_', 'VITE_'] config.publicDir = config.publicDir || 'resources' // do not copy public dir @@ -376,7 +376,7 @@ export function electronRendererVitePlugin(options?: ElectronPluginOptions): Plu config.envDir = config.envDir || path.resolve(root) - config.envPrefix = config.envPrefix || 'RENDERER_VITE_' + config.envPrefix = config.envPrefix || ['RENDERER_VITE_', 'VITE_'] } }, {