While it's explicitly stated in the doc:
We expect process.env.NODE_ENV to be available at module compilation. We cache this value.
In some js runtimes such as Cloudflare Workers and overall many lambda runtimes (WinterCG) the node.js globals are not available.
In tiny-invariant case, it causes the line const isProduction: boolean = process.env.NODE_ENV === 'production'; to crash at import time, because process is undefined.
I don't know how to properly fix this, as the exact expression process.env.NODE_ENV is used by bundlers, as summarized by [Claude][https://claude.ai/share/39324895-61ee-468d-a768-4362aa910e89).
I'm still creating this ticket in order to:
- share it with relevant parties such as WinterTC so that this feature may be standardized at some point in the future?
- get help from the community. Maybe there are some solutions I didn't think of?
Thanks for the great lib anyway!
While it's explicitly stated in the doc:
In some js runtimes such as Cloudflare Workers and overall many lambda runtimes (WinterCG) the node.js globals are not available.
In
tiny-invariantcase, it causes the lineconst isProduction: boolean = process.env.NODE_ENV === 'production';to crash at import time, becauseprocessis undefined.I don't know how to properly fix this, as the exact expression
process.env.NODE_ENVis used by bundlers, as summarized by [Claude][https://claude.ai/share/39324895-61ee-468d-a768-4362aa910e89).I'm still creating this ticket in order to:
Thanks for the great lib anyway!