#Loading env vars in `astro-config.mjs`

30 messages · Page 1 of 1 (latest)

regal cargo
#

I followed what the docs say about this topic

latent falcon
#

Hey @regal cargo, did you solve your issue? You followed the docs but it didn't work?

regal cargo
#

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

latent falcon
#

But either way, that snippet of code doesn't look right to me

regal cargo
#

yep

#

i was thinking that vite is a peer dependency and somehow injected within astro package

#

but it turns out

#

that it isn't

latent falcon
#

import.meta.env doesn't mean anything outside of vite, so accessing should always return undefined

regal cargo
#

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

latent falcon
#

Ah ok, it looks very cool btw

regal cargo
#

this snippet doesn't work

#

if you try to import that loadEnv helper

#

you will not receive it

latent falcon
#

If you have a minute to file an issue it would be very appreciated!

regal cargo
#

I will open an issue about it