Capítulo 441 de 456

Output Types

Core Idea

Full schema reference for every entry in the outputs object passed to onBuildComplete: pages, pagesApi, appPages, appRoutes, prerenders, staticFiles, middleware.

Key Concepts

  • outputs.pages / pagesApi / appPages / appRoutes: share a common shape — id, filePath, pathname, sourcePage, runtime: 'nodejs' | 'edge', assets, wasmAssets?, edgeRuntime?, config (maxDuration?, preferredRegion? deprecated, env?).
  • outputs.prerenders: ISR/static prerender entries — parentOutputId, groupId (shared revalidation group), route (template with dynamic segments), routeType (route|fallback|shell|page), response (empty|initial|complete), compute (blocking|resuming|static), htmlSize?, pprChain?, fallback?, config (allowQuery, allowHeader, bypassFor, renderingMode, partialFallback, bypassToken).
  • outputs.staticFiles: id, filePath, pathname, immutableHash? (content hash indicating immutability).
  • outputs.middleware: middleware.ts/proxy.ts function, always pathname: '/_middleware', includes config.matchers.
  • output: 'export' special case: only outputs.staticFiles is populated; all other arrays are empty.

Reference Tables

routeTypeMeaning
routeNon-UI route (Route Handler)
pagePage with no missing prerenderable params
shellMost specific reusable page shell for a URL class
fallbackReusable response specializable by filling more params
responseMeaning
emptyNo initial page response can be served
initialInitial response servable, not the completed UI (partial prerender)
completeResponse is complete (can be zero-byte, e.g. 204)
computeMeaning
blockingNo initial response before request-time compute starts (then streams)
resumingInitial response served while postponed work resumes server-side
staticNo per-request server compute needed

Anti-patterns

  • Assumir que pages/appPages/etc. terão dados quando output: 'export' estiver ativo: só staticFiles é populado nesse modo.
  • Ignorar routeType/response/compute: eles só aparecem na resposta primária de um grupo de prerender; outputs relacionados de RSC/data/segment os omitem.

Key Takeaways

  1. groupId agrupa prerenders que revalidam juntos.
  2. htmlSize só existe no output HTML primário do App Router; 0 significa shell HTML vazio.
  3. Todo output com runtime: 'edge' carrega edgeRuntime com a metadata canônica pra invocação (ver Invoking Entrypoints).

Connects To

  • Invoking Entrypoints (ch440): consome edgeRuntime de cada output.
  • Routing with @next/routing (ch438): usa pathname de vários desses outputs como input.