-
Notifications
You must be signed in to change notification settings - Fork 37
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
Don't default export from(process.env)
for environments that don't have process
#155
Comments
Thanks for raising this issue @smblee. I think it's a good point, and the module probably shouldn't assume that it's operating in a Node.js environment. One problem is that I think this will break backwards compatibility, unless the code is changed to use some sort of conditional check. If you change the line causing the issue to this, does it fix the issue? module.exports = from(typeof process === 'undefined' ? {} : process.env) |
@smblee any luck with that fix? If so I can merge it into this module and push a patch release. |
This is available in the beta release of version 8. You can install and test it using EDIT: See my latest comment in this thread for a fix with v7.x |
hi @evanshortiss , thanks for your work on this! Wanted to let you know that the beta worked just fine in my Vite React app -- head's up to anyone reading this, I had to place import.meta.env in an object like so: const env = from({ variables: import.meta.env }); |
@evanshortiss May I ask when you will release the beta version? |
@kenberkeley I have released v7.4.0 with this fix. You can now do the following for Vite environments:
Or in React with
|
Trying to use this lib with vite which uses
import.meta.env
as the default location for env vars and I get the following errorand looks like it's happening because the module exports
from(process.env)
by default and its failing sinceprocess
doesn't actually exist within the vite environment i am in (sveltekit).env-var/env-var.js
Line 55 in 3f5689e
The code:
The text was updated successfully, but these errors were encountered: