#Env vars are being expressed as "{}.VITE_XXXXXX" after building
9 messages · Page 1 of 1 (latest)
e.g. you have this env file:
GITHUB_ID=ANYID
GITHUB_SECRET=SOMESCRET
When you use an env variable in your code like this: import.meta.env.GITHUB_ID
Vite will transform this into:
{"GITHUB_ID":"ANYID","GITHUB_SECRET":"SOMESCRET"}.GITHUB_ID
Probably you didn't provide any env variable called VITE_BACKEND_URL during build time
(however keep in mind that vite will only expose environment variables with VITE_ prefixed to them by default)
I think it's 'To prevent accidentally leaking env variables to the client, only variables prefixed with VITE_ are exposed to your Vite-processed code.' https://vitejs.dev/guide/env-and-mode.html#env-files