egoist / egoist/tsup

Setting NODE_ENV to "production" without --minify

Open
#678 5 comments 0 reactions 0 assignees View on GitHub
need repro
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

I want to use the `replaceNodeEnv` flag together with `treeshake` to be able to create separate build outputs for production and development. To insert additional checks and console.logs only if the library user is in development.
But the `env` field seems to not be able to overwrite the default `"development"` for non-minified builds.
I don't want to use --minify, so that the output code is easier to inspect.
Is there any other way to set the NODE_ENV to `"production"`, so that it's respected by `replaceNodeEnv`?

Contributor guide

Open the contributing guide

Research direction

Trace how the `env`, `replaceNodeEnv`, `treeshake`, and `--minify` options are handled. Confirm whether a non-minified build can produce separate development and production outputs with `NODE_ENV` set to `"production"`; done means the supported configuration or required change is documented and covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.