Files
vercel__next.js/test/e2e/define/app/page.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

49 lines
1.0 KiB
JavaScript

/* eslint-disable no-undef */
import {
ClientValue,
ClientExpr,
ClientNumber,
ClientBoolean,
} from './client-component'
export default function Page() {
return (
<ul>
<li>
Server value:{' '}
{typeof MY_MAGIC_VARIABLE === 'string' ? MY_MAGIC_VARIABLE : 'not set'}
</li>
<li>
Client value: <ClientValue />
</li>
<li>
Server expr:{' '}
{typeof process.env.MY_MAGIC_EXPR === 'string'
? process.env.MY_MAGIC_EXPR
: 'not set'}
</li>
<li>
Client expr: <ClientExpr />
</li>
<li>
Server number:{' '}
{typeof MY_NUMBER_VARIABLE === 'number'
? String(MY_NUMBER_VARIABLE)
: 'not set'}
</li>
<li>
Client number: <ClientNumber />
</li>
<li>
Server boolean:{' '}
{typeof MY_BOOLEAN_VARIABLE === 'boolean'
? String(MY_BOOLEAN_VARIABLE)
: 'not set'}
</li>
<li>
Client boolean: <ClientBoolean />
</li>
</ul>
)
}