nitrojs / nitrojs/nitro

Inject `NODE_ENV` with `production` value by default for production runtime

Open
#2,046 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement node v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Ref https://github.com/nuxt/nuxt/issues/23402

While nitro externals tracer rewrites exports conditions to production (https://github.com/unjs/nitro/issues/844), in runtime of some externals there are still manual check for NODE_ENV. (hopefully, some day they use exports conditions with production support to remove need of this)

This is an alternative of previously PR https://github.com/unjs/nitro/pull/605 to inject only at runtime which is our more specific concern also works for all node runtimes without depending on commands

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Nuxt issue, Nitro issue #844, and prior PR #605 to compare the proposed runtime-only injection with exports-condition handling. Trace how Nitro handles production runtime behavior and verify the result across Node runtimes; done means production receives NODE_ENV=production without depending on commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
backend
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.