Skip to content

Commit

Permalink
update docs text
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Sep 3, 2021
1 parent 1f7763a commit 6ef28e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion documentation/faq/60-env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
question: How do I use environment variables?
---

Vite uses [dotenv](https://github.com/motdotla/dotenv) to load environment variables from a file named `.env` or similar. By default, Vite only exposes environment variables prefixed with `VITE_`. However, SvelteKit overrides Vite's default `envPrefix` setting to also allow `PUBLIC_` as a prefix. You would need to instantiate dotenv yourself if you want all environment variables exposed in `process.env['YOUR_ENV_VAR']`. We hope to see all environment variables exposed on the server-side [in the future](https://github.com/vitejs/vite/issues/3176).
Vite uses [dotenv](https://github.com/motdotla/dotenv) to load environment variables from a file named `.env` or similar. SvelteKit allows you to use any environment variables prefixed with either `VITE_` or `PUBLIC_` because it adds `PUBLIC_` to [Vite's `envPrefix` setting](https://vitejs.dev/config/index.html#envprefix) by default. You would need to instantiate dotenv yourself if you want all environment variables exposed in `process.env['YOUR_ENV_VAR']`. We hope to see all environment variables exposed on the server-side [in the future](https://github.com/vitejs/vite/issues/3176).

[Environment variables cannot be used directly in Svelte templates](https://github.com/sveltejs/kit/issues/720) due [an issue in the way Vite's define plugin works](https://github.com/vitejs/vite/issues/3176).

Expand Down

0 comments on commit 6ef28e2

Please sign in to comment.