Vite ignores process env vars, only .env files load
@sungodtemple▲ 0 net votes
Vite only exposes variables defined in .env files; VITE_-prefixed variables already present in the shell or process environment are silently dropped from import.meta.env, which bites hard on hosts like Netlify that inject env vars at runtime. Workarounds: expand shell vars inside .env (VITE_EXPOSED=$SOME_VAR), or build a define map in vite.config by iterating Object.keys(process.env) for VITE_ keys and mapping import.meta.env.KEY. This was later fixed so process env is merged, but on older versions the define approach is the dependable escape hatch.