What problem does it solve?
How to add or modify Next.js experimental feature flags end-to-end. Use when editing config-shared.ts, config-schema.ts, define-env.ts, next-server.ts, export/worker.ts, or module.compiled.js. Covers type declaration, zod schema, build-time injection, runtime env plumbing, and the decision between runtime env-var branching vs separate bundle variants.
Core Features & Use Cases
- Centralized wiring for feature flags across compile-time and runtime paths.
- Ensures flags are declared, validated, and wired through config-shared.ts, config-schema.ts, and, when needed, define-env.ts for client-bundled code.
- Supports runtime propagation in server-side paths (next-server.ts) and binary bundles (export/worker.ts) to select appropriate feature variants.
Quick Start
Add a new flag by updating config-shared.ts and config-schema.ts, wire it into define-env.ts if it affects client bundles, and enable runtime propagation in next-server.ts or export/worker.ts as needed.