Files
vercel__next.js/test/e2e/define/app/client-component.js
Andrew Imm efc0905db3 Compiler: Support boolean and number primtives in next.config defines (#92731)
Expand `config.compiler.define` to support number and boolean primitives
as well.

The support is already in Turbopack's rewrite engine, as well as
Webpack's DefinePlugin. We just need to modify the zod schema to
actually support passing numbers and bools.

Added an E2E test that should check all supported types.
2026-04-13 12:00:38 -07:00

39 lines
692 B
JavaScript

/* eslint-disable no-undef */
'use client'
export function ClientValue() {
return (
<>{typeof MY_MAGIC_VARIABLE === 'string' ? MY_MAGIC_VARIABLE : 'not set'}</>
)
}
export function ClientExpr() {
return (
<>
{typeof process.env.MY_MAGIC_EXPR === 'string'
? process.env.MY_MAGIC_EXPR
: 'not set'}
</>
)
}
export function ClientNumber() {
return (
<>
{typeof MY_NUMBER_VARIABLE === 'number'
? String(MY_NUMBER_VARIABLE)
: 'not set'}
</>
)
}
export function ClientBoolean() {
return (
<>
{typeof MY_BOOLEAN_VARIABLE === 'boolean'
? String(MY_BOOLEAN_VARIABLE)
: 'not set'}
</>
)
}