#Env vars are being expressed as "{}.VITE_XXXXXX" after building

9 messages · Page 1 of 1 (latest)

final prairie
#

Vite will transform all the import.meta.env into an object that contains all the env variables

#

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

fair spoke
#

(however keep in mind that vite will only expose environment variables with VITE_ prefixed to them by default)

final prairie