-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment variables from the environment are ignored #562
Comments
That's intended. If you want to explicitly expose a actual env variable, you can expand it in
|
This issue has caused me some hours because I couldn't figure out why the deployed app is failing even when the env VITE_* is set. I think the project doc/readme could have made it more explicit. 😞 |
Seems like that's not possible with tools like Netlify (they have an interface for env variables and then they (I think) pass them as CLI parameters) I thought env params approach when CLI is used directly is pretty common. What was the intention to handle them from the files only? For anyone who will search for the same issue - I solved it by using
|
This should be fixed in 956cd2c |
Could you please provide a snippet of how is the defined "viteEnv" later used within code ?
gives in an error with Typescript/vue3,
|
Did you do this? https://vitejs.dev/guide/features.html#client-types |
What about server side "only" env vars? I can easily use Example
|
I'm stuck too with SvelteKit for server routes |
@aiibe if the question is about Vite, please start a GitHub Discussion or join the chat at Vite Land. We have a #svelte channel there. Comments on old closed issues will probably get lost. About this particular problem, you could also join https://svelte.dev/chat If there is a concrete bug, please create a minimal reproduction and a new issue. |
Describe the bug
Only variables from
.env
files are loaded. Environment variables starting withVITE_
, but defined outside.env
files are not included inimport.meta.env
.Reproduction
VITE_
, usingcross-env
or other methods.https://github.com/Maronato/vite-env-repro
System Info
vite
version: v1.0.0-beta.12vue
version: 3.0.0-beta.24@vue/compiler-sfc
version: 3.0.0-beta.24Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: