Hi, new contributor here, trying to be help.
As of now, some tools/libs do production<->dev detection for various reasons:
However this process.env.NODE_ENV expression is not available by default in all runtimes, for ex. Cloudflare Workers: alexreardon/tiny-invariant#205 (without node compat)
There are already existing ideas to standardize this feature, for ex into a boolean __DEV__: https://github.com/jaredpalmer/tsdx?tab=readme-ov-file#__dev__
I suggest this feature to be considered in minimum common API. This expression should be easily detected by bundlers but also be working in production, being immutable and set from the outside.
Thanks!
edit: added an example
As of now, some tools/libs do production<->dev detection for various reasons:
process.env.NODE_ENVprocess.env.NODE_ENVHowever this
process.env.NODE_ENVexpression is not available by default in all runtimes, for ex. Cloudflare Workers: alexreardon/tiny-invariant#205 (without node compat)There are already existing ideas to standardize this feature, for ex into a boolean
__DEV__: https://github.com/jaredpalmer/tsdx?tab=readme-ov-file#__dev__I suggest this feature to be considered in minimum common API. This expression should be easily detected by bundlers but also be working in production, being immutable and set from the outside.
Thanks!
edit: added an example