hughsk / hughsk/envify

Doesn't support object destructuring or accessing process.env object

Open
#58 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
895
Forks
57
PR merge metrics
No merged PRs in 30d

Description

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:

```javascript
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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README and the transform behavior described in the issue, especially how literal process.env.SOMETHINGHERE references are handled. Determine whether the intended outcome is object-destructuring support, process.env access, or clearer documentation; done means the chosen behavior is implemented or documented and verified against the reported examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.