experimental (next.config)
Enables opt-in experimental Next.js features that may change.
Syntax
experimental: { ...flags } Parameters
| Name | Type | Required | Description |
|---|---|---|---|
experimental | object | No | Flags such as `ppr`, `dynamicIO`, `useCache`, `typedRoutes`, `serverActions`, `staleTimes`, `optimizePackageImports`. |
Returns
NextConfig — Toggles experimental behavior.
Examples
const nextConfig = {
experimental: {
typedRoutes: true,
optimizePackageImports: ['lucide-react'],
},
}
module.exports = nextConfig
// Partial Prerendering + dynamicIO (canary)
const nextConfig = {
experimental: {
ppr: 'incremental',
dynamicIO: true,
useCache: true,
},
}
module.exports = nextConfig
Notes
These flags gate not-yet-stable features; APIs/behavior can change
between minor/canary releases and some require the Next.js canary
build (e.g. `dynamicIO`, `useCache`, full `ppr`). `typedRoutes` adds
type-checked `href`s; `optimizePackageImports` tree-shakes large
barrel imports. Check the docs for the current set per version.