use environment variables in app.config.ts
im using
nuxt-icon
and it requires me to set my custom api host in app.config.ts
, but i cant seem to access environment variables or runtime config there. how do i even go about this7 Replies
Try
import.meta.env.{ENV_KEY}
wait thats epic
this doesnt transpile to anything
i dont think import.meta.env exists in nuxt 3
It does
It’s from vite
Be sure to prefix your env key with VITE_
ah, it was prefixed with NUXT_PUBLIC_
thats a bit annoying
still does not transpile
wait
no it does actually i was just expecting something different
That’s weird. Been working fine for me
it did take a VITE_ prefix to work though, thank you
Oh great. You’re welcome