Capítulo 436 de 456
Precise parameter reference for the two NextAdapter lifecycle hooks: modifyConfig and onBuildComplete.
modifyConfig(config, context): called for any CLI command that loads next.config.js. Params: config (complete Next.js config object), context.phase (build phase), context.nextVersion, context.projectDir (absolute path). Returns modified config, sync or async.onBuildComplete(context): called after build completes. Params include context.routing (routing phases/metadata), context.outputs (build outputs by type), context.projectDir, context.repoRoot, context.distDir, context.config (final config with modifyConfig applied), context.nextVersion, context.buildId.context.routing fields: beforeMiddleware, beforeFiles, afterFiles, dynamicRoutes, onMatch, fallback, shouldNormalizeNextData, rsc.| Hook | Key params |
|---|---|
modifyConfig | config, context.phase, context.nextVersion, context.projectDir |
onBuildComplete | context.routing, context.outputs, context.projectDir, context.repoRoot, context.distDir, context.config, context.nextVersion, context.buildId |
context.config em onBuildComplete já reflete as mudanças aplicadas por modifyConfig.routing.shouldNormalizeNextData indica se URLs /_next/data/<buildId>/... devem ser normalizadas durante o matching.routing.rsc carrega metadata de roteamento específica de React Server Components.routing.outputs.