mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Prerequisite for https://github.com/vercel/next.js/pull/95233 Constant evaluation of ```js if (!('NODE_ENV' in process.env)) { console.log('existing') } console.log('NODE_ENV' in process.env) ``` -> ```js if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable ; console.log(("TURBOPACK compile-time value", true)); ```
75 lines
1.5 KiB
JavaScript
75 lines
1.5 KiB
JavaScript
if (DEFINED_VALUE) {
|
|
console.log('DEFINED_VALUE')
|
|
}
|
|
|
|
if (DEFINED_TRUE) {
|
|
console.log('DEFINED_VALUE')
|
|
}
|
|
|
|
if (!DEFINED_NULL) {
|
|
console.log('DEFINED_NULL', DEFINED_NULL)
|
|
}
|
|
|
|
if (DEFINED_INT) {
|
|
console.log('DEFINED_INT', DEFINED_INT)
|
|
}
|
|
|
|
if (DEFINED_FLOAT) {
|
|
console.log('DEFINED_FLOAT', DEFINED_FLOAT)
|
|
}
|
|
|
|
if (DEFINED_ARRAY) {
|
|
console.log('DEFINED_ARRAY', DEFINED_ARRAY)
|
|
}
|
|
|
|
if (DEFINED_EVALUATE) {
|
|
console.log('DEFINED_EVALUATE', DEFINED_EVALUATE)
|
|
}
|
|
|
|
if (DEFINED_EVALUATE_NESTED) {
|
|
console.log('DEFINED_EVALUATE_NESTED', DEFINED_EVALUATE_NESTED)
|
|
}
|
|
|
|
if (A.VERY.LONG.DEFINED.VALUE) {
|
|
console.log('A.VERY.LONG.DEFINED.VALUE')
|
|
}
|
|
|
|
if (process.env.NODE_ENV) {
|
|
console.log('something')
|
|
}
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
console.log('production')
|
|
}
|
|
|
|
var p = process
|
|
|
|
console.log(A.VERY.LONG.DEFINED.VALUE)
|
|
console.log(DEFINED_VALUE)
|
|
console.log(p.env.NODE_ENV)
|
|
|
|
if (p.env.NODE_ENV === 'production') {
|
|
console.log('production')
|
|
}
|
|
|
|
p.env.NODE_ENV == 'production'
|
|
? console.log('production')
|
|
: console.log('development')
|
|
|
|
// TODO short-circuit is not implemented yet
|
|
p.env.NODE_ENV != 'production' && console.log('development')
|
|
p.env.NODE_ENV == 'production' && console.log('production')
|
|
|
|
console.log(__dirname)
|
|
|
|
// Test that WARNED_VALUE triggers a warning but still gets replaced
|
|
console.log(WARNED_VALUE)
|
|
if (WARNED_VALUE === 'replacement') {
|
|
console.log('warning replacement works')
|
|
}
|
|
|
|
if (!('NODE_ENV' in process.env)) {
|
|
console.log('existing')
|
|
}
|
|
console.log('NODE_ENV' in process.env)
|