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
It took me about 2 hours of debugging to release this, but when you think about how envify works, it makes sense. I was using object destructuring to cut down on some boilerplate, which works fine in node:
const{VAR_A,VAR_B,VAR_C}=process.env
And none of them were being set. So I added a console.log(process.env) beneath it, which output {}, and that made me think envify wasn't being executed at all. Of course it's because envify is parsing the file looking for process.env.SOMETHINGHERE literally.
It would be nice if object destructuring were supported, though I can understand why it would be challenging, and accessing process.env would almost always be a mistake (except for debugging). Perhaps the solution here is just to make this more clear in the readme, that this module doesn't actually provide a process.env object; it basically just does string replacing?
The text was updated successfully, but these errors were encountered:
Yep, it's literally a find-and-replace. Such is the nature of most transforms haha. Agree that if it isn't clear we should update the docs. PR welcome!
@yoshuawuyts currently the find and replace works if you pass a single var const {VAR_A} = process.env but not if you pass many, I understand that this is because you use a find and replace for /\bprocess\.env\b/ but there is a way that we can make so it support both.
It took me about 2 hours of debugging to release this, but when you think about how envify works, it makes sense. I was using object destructuring to cut down on some boilerplate, which works fine in node:
And none of them were being set. So I added a
console.log(process.env)
beneath it, which output{}
, and that made me think envify wasn't being executed at all. Of course it's because envify is parsing the file looking forprocess.env.SOMETHINGHERE
literally.It would be nice if object destructuring were supported, though I can understand why it would be challenging, and accessing
process.env
would almost always be a mistake (except for debugging). Perhaps the solution here is just to make this more clear in the readme, that this module doesn't actually provide aprocess.env
object; it basically just does string replacing?The text was updated successfully, but these errors were encountered: