Skip to content

feat: set NODE_ENV by mode - #81

Merged
lukeed merged 3 commits into
mainfrom
feat/node-env
Oct 23, 2026
Merged

lukeed merged 3 commits into
mainfrom
feat/node-env

Conversation

@lukeed

@lukeed lukeed commented Oct 22, 2026

Copy link
Copy Markdown
Owner

A config could not tell bongo dev from bongo build. A user checked process.argv.includes('dev') in a module that the config imported first, because other modules read the mode as they load.

Changes

  • normalize() sets process.env.NODE_ENV before the config loads: development for bongo dev, and production for bongo build. A value that is already set stays.
  • The memo key includes NODE_ENV, so a build with another value renders every page. Before, a page kept the output of the last mode until --fresh.
  • Docs: a "Dev or build" section in config.md, and notes in cli.md.

Not changed

  • Client scripts. A separate PR defines the mode for them.
  • Other environment variables are still not in the memo key, as cli.md documents.

Test plan

  • bun test (854 pass), bunx tsc -p ., bunx tsc -p build, bun run build
  • New tests fail without the change: normalize by mode, the CLI build that reads NODE_ENV in a config import, and the memo in a new process
  • By hand: a config import reads development under bongo dev and production under bongo build. NODE_ENV=staging stays.

@lukeed
lukeed merged commit 01b5792 into main Oct 23, 2026
4 checks passed
@lukeed
lukeed deleted the feat/node-env branch October 23, 2026 00:17
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

Successfully merging this pull request may close these issues.

1 participant