Skip to content
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

Guidelines for treating NODE_ENV in new code #2925

Closed
valango opened this issue Jan 31, 2020 · 1 comment
Closed

Guidelines for treating NODE_ENV in new code #2925

valango opened this issue Jan 31, 2020 · 1 comment

Comments

@valango
Copy link

valango commented Jan 31, 2020

A question of to what value should process.env.NODE_ENV default to if not set, is a quite important one. There is plenty of discussion about it out there, ones advocating 'production' and others 'development'. This can be confusing.

I suggest publishing the following suggestion somewhere in guides chapter.

If process.env.NODE_ENV is undefined, the code should assume default value as follows:

  • generic library code: 'development' as the best choice when writing new code;
  • (server) application code: 'development' because in real life this code is launced by script or loader, explicitly setting the NODE_ENV value;
  • utility package code: 'production', because it's likely a developer wants to debug his/her own code, not the code of installed npm packages or tools like npm or rimraf.
@ovflowd
Copy link
Member

ovflowd commented Mar 12, 2023

Probably not relevant anymore as this guide doesn't exist anymore, and with the learn pages from nodejs.dev coming here soon, should also not be relevant anymore.

@ovflowd ovflowd closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants