You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During development, Vite loads .env files according to this logic. svelte-kit preview doesn't read .env files; as such, env vars are missing.
Describe the proposed solution
Load .env files with the same logic Vite uses (this is handwavy — Vite allows arbitrary 'modes', so it's unclear which file(s) we'd load in preview beyond .env and .env.local. .env.prod and .env.prod.local?)
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Hmm I have mixed feelings about whether this would be the desired behavior. Production builds don't automatically look at .env (I admit I haven't specifically checked, but I hope they do not!) so why should previews?
preview loading .env might be convenient, but it sounds unwise to me. As in production, you should be responsible for making sure the environment variables in question are actually present in your environment.
I think this is in relation to using tools like dotenv and env-cmd. The intended purpose is to load env variables at runtime. Is there a better way to load env variables at runtime?
Describe the problem
During development, Vite loads
.env
files according to this logic.svelte-kit preview
doesn't read.env
files; as such, env vars are missing.Describe the proposed solution
Load
.env
files with the same logic Vite uses (this is handwavy — Vite allows arbitrary 'modes', so it's unclear which file(s) we'd load inpreview
beyond.env
and.env.local
..env.prod
and.env.prod.local
?)Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: