My usage looks like this. Super basic. Note I’m trying basically everything that could possibly work (fetching the globally defined Vite vars, as well as just directly trying to read the Vercel env vars). Everything is logged as undefined.
If I add a custom key under the Env variables in my project (such as “VITE_TEST”), I can directly read them as “import.meta.env.VITE_TEST” without issue.
Hey! I don’t mean custom env variables, I mean the system env variables defined here: System environment variables. These shouldn’t be set in the .env file manually right?
Hi @mchen10, sorry that it didn’t solve this issue.
Can you please share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.
Ok I managed to figure it out. I have no idea why, but in my build, I need to not append “VITE” to the env var. So defining the global var in my build config as