Capítulo 273 de 456
Field-by-field reference for the two NextAdapter lifecycle functions: modifyConfig and onBuildComplete.
async modifyConfig(config, context): called for any CLI command that loads next.config.js, to let the adapter mutate the config.async onBuildComplete(context): called once the build finishes, with detailed routing and output data.modifyConfig param | Meaning |
|---|---|
config | Complete Next.js configuration object |
context.phase | Current build phase |
context.nextVersion | Next.js version in use |
context.projectDir | Absolute path to project dir |
| Returns | Modified config object (may be async) |
onBuildComplete param | Meaning |
|---|---|
context.routing.beforeMiddleware | Routes executed before middleware (headers/redirects) |
context.routing.beforeFiles | Rewrites checked before filesystem matching |
context.routing.afterFiles | Rewrites checked after filesystem matching |
context.routing.dynamicRoutes | Dynamic route matching table |
context.routing.onMatch | Routes applied after a successful match (e.g. immutable cache headers) |
context.routing.fallback | Final rewrite fallback routes |
context.routing.shouldNormalizeNextData | Whether /_next/data/<buildId>/... URLs are normalized during matching |
context.routing.rsc | Route metadata for RSC routing behavior |
context.outputs | Build outputs organized by type (see Output Types) |
context.projectDir | Absolute path to project dir |
context.repoRoot | Absolute path to detected repository root |
context.distDir | Absolute path to build output dir |
context.config | Final config, with modifyConfig applied |
context.nextVersion | Next.js version in use |
context.buildId | Unique identifier for the current build |
modifyConfig operates on the raw config before build; onBuildComplete operates on the finished artifact graph.context.config inside onBuildComplete already reflects any changes modifyConfig made.routing.rsc and routing.shouldNormalizeNextData are the fields most relevant to adapters that need to mimic Next.js's own RSC/data-URL matching.