-
Notifications
You must be signed in to change notification settings - Fork 25
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
process.env
is prefered over import.meta.env
#115
Comments
cc @pi0 any thoughts? |
Opened one at astro too withastro/roadmap#853 |
process.env
is prefered over import.meta.env
Thanks for explaining the issue! Well this is interesting. I will followup your upstream issue. It is i guess more of a question that for std-env we shall prefer Also as mentioned in astro's discussion, if Astro (or even Vite) needs a special logic, i am open to it. Do you think we should still track it here for std-env too? |
What do you think about merging them? So like |
We can...But it also costs. Also makes another issue. If there is a later change to One other thing we can do is that inside proxy, we iterate over sources and check each if exists and key exists in it. I think it is an acceptable compromise and middle-ground to fix the issue. Basically |
Environment
node 20.11
std-env 3.7
Reproduction
not really relevant
Describe the bug
So I'm not sure if I'd call this a bug per-se, maybe more of an observation to open up a discussion how we could solve this.
Astro is a bit (if you ask me) dumb in the way that they have a
process.env
on the server but they don't populate it with stuff from your env file. That stuff goes onimport.meta.env
. This means that the following logs undefined:This is cause (like I said), process does exists, so
std-env
chooses it as the env object:std-env/src/env.ts
Lines 5 to 10 in 7528b13
Any ideas how to solve this in a nice way? I think this is just a stupid behavior from Astro but any workaround we can do to support this would be great. We recently moved to std-env in uploadthing to have a single source of truth for accessing environment variables but then I stumbled on this edge-case...
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: