#Using NODE_ENV to specify whether to show something in production or not

7 messages · Page 1 of 1 (latest)

primal wolf
#

Hey!

Recently I've been using something like this a lot:

if (process.env.NODE_ENV === "development") {
  console.log('Thing:' thing);
}

And I've been doing that specifically to just log arrays and objects to make it easier for me to work with them since I enjoy it this way. I've been wondering if it has any downsides? I was also wondering if it hurts when such code is commited and pushed to production - it should be fine since it won't run anyways, right?

Or maybe there's a better way to do it and I am missing something? Appreciate all and any advice peepoLove

little micaBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

rapid nimbus
primal wolf
rapid nimbus
primal wolf
#

gotcha, thanks a lot for the help!

little micaBOT