N
Nuxt8mo ago
Vap0r1ze

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 this
7 Replies
pyplacca
pyplacca8mo ago
Try import.meta.env.{ENV_KEY}
Vap0r1ze
Vap0r1zeOP8mo ago
wait thats epic this doesnt transpile to anything i dont think import.meta.env exists in nuxt 3
pyplacca
pyplacca8mo ago
It does It’s from vite Be sure to prefix your env key with VITE_
Vap0r1ze
Vap0r1zeOP8mo ago
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
pyplacca
pyplacca8mo ago
That’s weird. Been working fine for me
Vap0r1ze
Vap0r1zeOP8mo ago
it did take a VITE_ prefix to work though, thank you
pyplacca
pyplacca8mo ago
Oh great. You’re welcome
Want results from more Discord servers?
Add your server