Open
Description
Describe the bug
vite从5.3.6升级到5.4.0后,import.meta.env无法正常读取,会报错 ReferenceError: Cannot access 'vite_import_meta_env' before initialization
export function getPackEnv(): string {
console.error('111 2' + JSON.stringify(process.env))
console.error('111 ' + JSON.stringify(import.meta.env))
return (
import.meta.env?.MAIN_VITE_APP_ENV ||
import.meta.env?.RENDERER_VITE_APP_ENV ||
import.meta.env?.PRELOAD_VITE_APP_ENV
)
}
第一行process.env可以正常打印出
Electron-Vite Version
3.1.0
Electron Version
22.3.27
Vite Version
5.4.0
Validations
- Follow the Code of Conduct.
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
No labels