revert: chore: remove process env define (#159)
This commit is contained in:
parent
6627e81f66
commit
8c924188de
|
@ -29,6 +29,14 @@ function findInput(root: string, scope = 'renderer'): string {
|
|||
return ''
|
||||
}
|
||||
|
||||
function processEnvDefine(): Record<string, string> {
|
||||
return {
|
||||
'process.env': `process.env`,
|
||||
'global.process.env': `global.process.env`,
|
||||
'globalThis.process.env': `globalThis.process.env`
|
||||
}
|
||||
}
|
||||
|
||||
export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[] {
|
||||
return [
|
||||
{
|
||||
|
@ -75,6 +83,9 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
|
|||
const buildConfig = mergeConfig(defaultConfig.build, build)
|
||||
config.build = buildConfig
|
||||
|
||||
config.define = config.define || {}
|
||||
config.define = { ...processEnvDefine(), ...config.define }
|
||||
|
||||
config.envPrefix = config.envPrefix || 'MAIN_VITE_'
|
||||
|
||||
config.publicDir = config.publicDir || 'resources'
|
||||
|
@ -174,6 +185,9 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
|||
const buildConfig = mergeConfig(defaultConfig.build, build)
|
||||
config.build = buildConfig
|
||||
|
||||
config.define = config.define || {}
|
||||
config.define = { ...processEnvDefine(), ...config.define }
|
||||
|
||||
config.envPrefix = config.envPrefix || 'PRELOAD_VITE_'
|
||||
|
||||
config.publicDir = config.publicDir || 'resources'
|
||||
|
|
Loading…
Reference in a new issue