Setting NODE_ENV to "production" without --minify
See original GitHub issueI 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
?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
You are currently using minified code outside of NODE_ENV ...
i created react app and i need to have 3 node_env: "start": "cross-env NODE_ENV=development webpack serve", "build-accept": "cross-env ...
Read more >NODE_ENV related warning when used in minified bundle #534
You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of ...
Read more >Concatenation and Minification | Laravel Mix Documentation
Once again, the minification will only take place during a production build. ( export NODE_ENV=production ). There is no need to call mix.combine(['one.js',...
Read more >Express Tutorial Part 7: Deploying to production
We can remove stack traces in error pages by setting the NODE_ENV environment variable to production (it is set to 'development' by default) ......
Read more >Performance Best Practices Using Express in Production
Set NODE_ENV to “production ” · Ensure your app automatically restarts · Run your app in a cluster · Cache request results ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
yes please
I’ve stumbled on this issue recently again, but this time I was able to walk around it by defining
esbuildOptions
instead:Here is the “fixed” example: https://stackblitz.com/edit/tsup-treeshake-development-issue-qobqkw