Loading environment variables to mdx files
kyhyco opened this issue · 1 comments
kyhyco commented
Hello!
Is it possible to load a .env
file into vocs?
I read up on how to load env variables on vite:
- https://vitejs.dev/config/shared-options.html#envprefix
- https://vitejs.dev/config/#using-environment-variables-in-config
- https://vitejs.dev/guide/env-and-mode.html#env-files
None of them are working though.
kyhyco commented
Long day + new to vite
Setting env var to VITE_KEY_NAME
and fetching like this works fine:
const VITE_KEY_NAME = import.meta.env.VITE_KEY_NAME;