Pular para o conteúdo
Documentação do Next.js PT-BR
Esta página ainda está em inglês. A tradução ainda não foi feita; o conteúdo abaixo é o original de nextjs.org.

Output Types

The outputs object contains arrays of build output types:

  • outputs.pages: React pages from the pages/ directory
  • outputs.pagesApi: API routes from pages/api/
  • outputs.appPages: React pages from the app/ directory
  • outputs.appRoutes: API and metadata routes from app/
  • outputs.prerenders: ISR-enabled routes and static prerenders
  • outputs.staticFiles: Static assets and auto-statically optimized pages
  • outputs.middleware: Middleware function (if present)

Note: When config.output is set to 'export', only outputs.staticFiles is populated. All other arrays (pages, appPages, pagesApi, appRoutes, prerenders) will be empty since the entire application is exported as static files.

For any route output with runtime: 'edge', edgeRuntime is included and contains the canonical entry metadata for invoking that output in your edge runtime. Note that the Edge Runtime is deprecated.

Pages (outputs.pages)

React pages from the pages/ directory:

{
  type: 'PAGES'
  id: string           // Route identifier
  filePath: string     // Path to the built file
  pathname: string     // URL pathname
  sourcePage: string   // Original source file path in pages/ directory
  runtime: 'nodejs' | 'edge'
  assets: Record<string, string>  // Traced dependencies (key: relative path from repo root, value: absolute path)
  assetsHashes: Record<string, string>  // Content hashes of each `assets` entry (key: same as `assets`, value: content hash)
  wasmAssets?: Record<string, string>  // Bundled wasm files (key: name, value: absolute path)
  edgeRuntime?: {
    modulePath: string    // Absolute path to the module registered in the edge runtime
    entryKey: string      // Canonical key used by the edge entry registry
    handlerExport: string // Export name to invoke, currently 'handler'
  }
  config: {
    maxDuration?: number  // Maximum duration of the route in seconds
    preferredRegion?: string | string[]  // Preferred deployment region (deprecated)
    env?: Record<string, string>  // Environment variables (edge runtime only)
  }
}

API Routes (outputs.pagesApi)

API routes from pages/api/:

{
  type: 'PAGES_API'
  id: string           // Route identifier
  filePath: string     // Path to the built file
  pathname: string     // URL pathname
  sourcePage: string   // Original relative source file path
  runtime: 'nodejs' | 'edge'
  assets: Record<string, string>  // Traced dependencies (key: relative path from repo root, value: absolute path)
  assetsHashes: Record<string, string>  // Content hashes of each `assets` entry (key: same as `assets`, value: content hash)
  wasmAssets?: Record<string, string>  // Bundled wasm files (key: name, value: absolute path)
  edgeRuntime?: {
    modulePath: string    // Absolute path to the module registered in the edge runtime
    entryKey: string      // Canonical key used by the edge entry registry
    handlerExport: string // Export name to invoke, currently 'handler'
  }
  config: {
    maxDuration?: number  // Maximum duration of the route in seconds
    preferredRegion?: string | string[]  // Preferred deployment region (deprecated)
    env?: Record<string, string>  // Environment variables (edge runtime only)
  }
}

App Pages (outputs.appPages)

React pages from the app/ directory:

{
  type: 'APP_PAGE'
  id: string           // Route identifier
  filePath: string     // Path to the built file
  pathname: string     // URL pathname. Includes .rsc suffix for RSC routes
  sourcePage: string   // Original relative source file path
  runtime: 'nodejs' | 'edge' // Runtime the route is built for
  assets: Record<string, string>  // Traced dependencies (key: relative path from repo root, value: absolute path)
  assetsHashes: Record<string, string>  // Content hashes of each `assets` entry (key: same as `assets`, value: content hash)
  wasmAssets?: Record<string, string>  // Bundled wasm files (key: name, value: absolute path)
  edgeRuntime?: {
    modulePath: string    // Absolute path to the module registered in the edge runtime
    entryKey: string      // Canonical key used by the edge entry registry
    handlerExport: string // Export name to invoke, currently 'handler'
  }
  config: {
    maxDuration?: number  // Maximum duration of the route in seconds
    preferredRegion?: string | string[]  // Preferred deployment region (deprecated)
    env?: Record<string, string>  // Environment variables (edge runtime only)
  }
}

App Routes (outputs.appRoutes)

API and metadata routes from the app/ directory:

{
  type: 'APP_ROUTE'
  id: string           // Route identifier
  filePath: string     // Path to the built file
  pathname: string     // URL pathname
  sourcePage: string   // Original relative source file path
  runtime: 'nodejs' | 'edge' | 'go' // Runtime the route is built for
  assets: Record<string, string>  // Traced dependencies (key: relative path from repo root, value: absolute path)
  assetsHashes: Record<string, string>  // Content hashes of each `assets` entry (key: same as `assets`, value: content hash)
  wasmAssets?: Record<string, string>  // Bundled wasm files (key: name, value: absolute path)
  edgeRuntime?: {
    modulePath: string    // Absolute path to the module registered in the edge runtime
    entryKey: string      // Canonical key used by the edge entry registry
    handlerExport: string // Export name to invoke, currently 'handler'
  }
  config: {
    maxDuration?: number  // Maximum duration of the route in seconds
    preferredRegion?: string | string[]  // Preferred deployment region (deprecated)
    env?: Record<string, string>  // Environment variables (edge runtime only)
  }
}

With the experimental route.go convention, App Router Go handlers use runtime: 'go'. The existing filePath points to a compiled HTTP server executable, and sourcePage keeps the same source-route identity as Node.js outputs. No new output keys are introduced. Go outputs do not include the shared Node.js runtime files in assets.

An adapter that supports Go must package the executable and declared assets for a compatible operating system and architecture, then start its server with PORT set. Each Go handler is emitted independently; Go pages, middleware, and prerender parents are not part of this experiment. See Invoking Entrypoints.

Prerenders (outputs.prerenders)

ISR-enabled routes and static prerenders:

{
  type: 'PRERENDER'
  id: string           // Route identifier
  pathname: string     // URL pathname
  parentOutputId: string  // ID of the source page/route
  groupId: number        // Revalidation group identifier (prerenders with same groupId revalidate together)
  route: string           // Source route matcher aligned with the filesystem route, keeping dynamic segments (e.g. /blog/[slug] for the prerendered path /blog/first)
  routeType?: 'route' | 'fallback' | 'shell' | 'page'  // Kind of canonical response
  response?: 'empty' | 'initial' | 'complete'  // Completeness before request-time work
  compute?: 'blocking' | 'dynamic' | 'resuming' | 'static'  // Request-time compute mode for serving the output
  htmlSize?: number       // Byte size of the prerendered App Router HTML shell
  pprChain?: {
    headers: Record<string, string>  // PPR chain headers (e.g., 'next-resume': '1')
  }
  parentFallbackMode?: false | null | string  // false: no additional paths (fallback: false), null: blocking render, string: path to HTML fallback
  fallback?: {
    filePath: string | undefined  // Path to the fallback file (HTML, JSON, or RSC)
    initialStatus?: number  // Initial status code
    initialHeaders?: Record<string, string | string[]>  // Initial headers
    initialExpiration?: number  // Initial expiration time in seconds
    initialRevalidate?: number | false  // Initial revalidate time in seconds, or false for fully static
    postponedState: string | undefined  // Serialized PPR state used for resuming rendering
  }
  config: {
    allowQuery?: string[]     // Allowed query parameters considered for the cache key
    allowHeader?: string[]    // Allowed headers for ISR
    bypassFor?: RouteHas[]    // Cache bypass conditions
    renderingMode?: 'STATIC' | 'PARTIALLY_STATIC'  // STATIC: fully static, PARTIALLY_STATIC: PPR-enabled
    partialFallback?: boolean  // Serves a partial fallback shell that should be upgraded to a full route in the background
    bypassToken?: string      // Generated token that signals the prerender cache should be bypassed
  }
}

Prerender classification

routeType, response, and compute are emitted together on the primary response in a prerender group and on full-route App Router RSC outputs. HTML and RSC outputs have independent classifications. Pages Router data outputs and static segment-prefetch outputs omit these fields. Prerender outputs for dynamic route patterns with fallback: false also omit classification because they do not serve paths that were not prerendered at build time.

routeType identifies the kind of canonical response:

  • route: a non-UI route, such as a Route Handler
  • page: a page whose URL has no missing prerenderable parameters
  • shell: the most specific reusable page shell for its class of URLs
  • fallback: a reusable page response that can be specialized by filling more prerenderable parameters

response describes how complete the response is before request-time work:

  • empty: no initial page response can be served
  • initial: an initial response can be served, but it is not the completed page UI. In practice, this only applies to UI routes that are partially prerenderable
  • complete: the response is complete; this can include a zero-byte response body, such as a 204 Route Handler response

An empty response does not imply a cache miss. A prerender can have no initial HTML but still provide cached postponed state for request-time rendering.

compute describes the request-time compute mode for serving the output:

  • blocking: when no usable cached prerender is available, the response must wait for prerendering or revalidation. The resulting output can still need request-time server work
  • dynamic: request-time rendering produces the first response bytes, without a required prerender first. The response can stream while rendering continues
  • resuming: an initial response is served while postponed work resumes on the server
  • static: the generated output needs no per-request server rendering. A missing or stale prerender can still require generation or revalidation

An empty PPR shell uses response: 'empty' and compute: 'dynamic' when the server can render the request without first waiting for a separate prerender. This applies to both concrete built paths and dynamic route patterns. A platform can use this classification to render a cache-miss response dynamically while prerendering in the background. For example, instant = false permits an empty shell but does not require blocking prerendering.

An explicit blocking parameter-matching policy uses response: 'empty' and compute: 'blocking' for the matcher that handles paths not generated at build time. That policy also applies when an on-demand prerender expires or is evicted, even if the cached result was partial. A stale prerender that is still usable follows the existing stale-while-revalidate behavior. Concrete paths generated at build time use the classification of their own prerendered output.

Classified full-route RSC outputs use response: 'complete' and compute: 'static' when they contain a complete reusable RSC payload. Outputs that require request-time RSC rendering normally use response: 'empty' and compute: 'dynamic'. The render can stream before it finishes. Cached postponed state can provide data for that render, but it is not an initial RSC response and does not make the output resuming.

Routes with ensureStatic = 'navigation' use response: 'empty' and compute: 'static' for both HTML and full-route RSC outputs that cover paths not generated at build time, such as /products/[slug] and /products/[slug].rsc. These outputs have no fallback response. The platform must wait for Next.js to prerender a new path before serving its response. The generated output needs no per-request server rendering. If the path requires dynamic server work, prerendering fails validation instead. Concrete built paths also use compute: 'static', with a complete full-route RSC response. Their HTML response can be complete, or initial when UI finishes in the browser.

Full-route RSC outputs for an explicitly blocking parameter matcher use response: 'empty' and compute: 'blocking'. The platform must produce a usable prerender before serving the response, including when an on-demand result expires or is evicted. The generated result can still need request-time RSC rendering. Concrete built paths use their own classification instead of inheriting the unknown-parameter policy.

An HTML response can be initial while its RSC output is complete, for example when a Client Component resolves a Suspense boundary in the browser. A complete generic HTML shell can also have an empty RSC output when its Flight router tree still requires concrete route parameters.

htmlSize is only included on the primary App Router HTML output. A value of 0 means that the HTML shell is empty. Pages Router prerenders, Route Handlers, and related RSC, data, and segment outputs omit it.

Static Files (outputs.staticFiles)

Static assets and auto-statically optimized pages:

{
  type: 'STATIC_FILE'
  id: string // Unique identifier for this static file output
  filePath: string // Absolute filesystem path to the built file
  pathname: string // The routable URL pathname for this static file
  immutableHash: string | undefined // Content hash when the filename contains a hash, indicating the file is immutable
}

See Supporting immutable static assets for more information about immutableHash.

Middleware (outputs.middleware)

middleware.ts (.js/.ts) or proxy.ts (.js/.ts) function (if present):

{
  type: 'MIDDLEWARE'
  id: string           // Route identifier
  filePath: string     // Path to the built file
  pathname: string      // Always '/_middleware'
  sourcePage: string    // Always 'middleware'
  runtime: 'nodejs' | 'edge' // Runtime the route is built for
  assets: Record<string, string>  // Traced dependencies (key: relative path from repo root, value: absolute path)
  assetsHashes: Record<string, string>  // Content hashes of each `assets` entry (key: same as `assets`, value: content hash)
  wasmAssets?: Record<string, string>  // Bundled wasm files (key: name, value: absolute path)
  edgeRuntime?: {
    modulePath: string    // Absolute path to the module registered in the edge runtime
    entryKey: string      // Canonical key used by the edge entry registry
    handlerExport: string // Export name to invoke, currently 'handler'
  }
  config: {
    maxDuration?: number  // Maximum duration of the route in seconds
    preferredRegion?: string | string[]  // Preferred deployment region (deprecated)
    env?: Record<string, string>  // Environment variables (edge runtime only)
    matchers?: Array<{
      source: string  // Source pattern
      sourceRegex: string  // Compiled regex for matching requests
      has: RouteHas[] | undefined  // Positive matching conditions
      missing: RouteHas[] | undefined  // Negative matching conditions
    }>
  }
}