#Loading env vars in `astro-config.mjs`
30 messages · Page 1 of 1 (latest)
Hey @regal cargo, did you solve your issue? You followed the docs but it didn't work?
i figured something else
thanks tho
but I didn't resolve my issue like docs stated using the loadEnv helper function
for some reason the vite package cannot be found
when you import the loadEnv
That's probably saying that you need to install vite
But either way, that snippet of code doesn't look right to me
yep
i was thinking that vite is a peer dependency and somehow injected within astro package
but it turns out
that it isn't
import.meta.env doesn't mean anything outside of vite, so accessing should always return undefined
this only works ont he client side
not for server side
i'm playing around with the TigrisDB integration that they build for Astro
that's why i wanted to inject the env vars within the config file
until i found about this
Ah ok, it looks very cool btw
this snippet doesn't work
if you try to import that loadEnv helper
you will not receive it
Yup it doesn't seem it would
If you have a minute to file an issue it would be very appreciated!
I will open an issue about it