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