Commit Graph

3 Commits

Author SHA1 Message Date
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
Will Binns-Smith 94b246469e next.config.ts: Implement compiler.defineServer for server-only constants (#79225)
Like `compiler.define`, this allows users to create compile-time
constants both Turbopack and webpack from a single API.
`compiler.defineServer` instead only makes these constants available for
server or edge environments, not the client environment.
2025-05-19 12:25:46 -07:00
Luca Forstner 1b1cb3eece Add compiler.define option (#71802)
Adds a `compiler.define` option to next.config.js to statically replace
any variables during build-time for Turbopack. This is similar to
Webpack's `DefinePlugin`.

Relates to: https://github.com/vercel/next.js/discussions/71476

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-11-12 21:13:47 +01:00