DEV Community

Discussion on: Stop copying your process.env.NODE_ENV to local variables! 🤯

Collapse
 
naismith profile image
Chris Naismith

Yes using tools like babel will do the replacement. But from readability - it's much easier to assign it to a variable and continue to use that variable. Assigning it to a variable also allows for defaults if something is not set, like a port number being defaulted to 3000.

Collapse
 
lgraziani2712 profile image
Luciano Graziani • Edited

That's true if you know you're going to keep using that variable (and the code around it) in your production code.