Configuration

Output file tracing configuration

Tracing estimates server file dependencies for deployment. Expand the root only to a trusted workspace boundary and use narrowly scoped include or exclude patterns for files that static analysis cannot determine. Broad patterns risk copying secrets or unrelated assets; excludes can break startup or requests. Example context: Next.js 16.x documentation lane; illustrative snippet or file tree, not executed. Exact candidate patch 16.4.6 remains unverified. Expected behavior / verification: Inspect the clean deployment artifact for the synthetic catalog file and verify the endpoint in a fresh directory. Confirm private files are absent; tracing is not a secret scanner.

Formal Syntax & Structure

nextjs syntaxnextjs
outputFileTracingRoot; outputFileTracingIncludes; outputFileTracingExcludes

Working Example

Example Snippetnextjs
// next.config.mjs — assumes apps/web is two levels below workspace rootimport path from 'node:path';import { fileURLToPath } from 'node:url';const here = path.dirname(fileURLToPath(import.meta.url));export default { output: 'standalone', outputFileTracingRoot: path.join(here, '../..'), outputFileTracingIncludes: { '/api/catalog': ['./fixtures/catalog.json'] } };
Next.js Reference