Skip to content

docs: correct the claim that Turbopack ignores outputFileTracingIncludes - #247

Merged
jouwdan merged 1 commit into
mainfrom
claude/mei-134-tracing-claim-correction
Aug 26, 2026
Merged

docs: correct the claim that Turbopack ignores outputFileTracingIncludes#247
jouwdan merged 1 commit into
mainfrom
claude/mei-134-tracing-claim-correction

Conversation

@jouwdan

@jouwdan jouwdan commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

MEI-134's premise was wrong, and it was mine. This corrects the record rather than implementing the ticket.

The claim

Two documents said, in different words, that outputFileTracingIncludes never executes:

outputFileTracingIncludes cannot put them back while next build defaults to Turbopack, for which Next skips trace collection entirely. — docs/vercel.md

standalone makes Vercel's builder read .next/next-server.js.nft.json, and Next skips the tracing that writes it whenever the bundler is Turbopack — docs/development.md

The reasoning came from next/dist/build/index.js:1627, which is real:

if (bundler !== _bundler.Bundler.Turbopack && !isGenerateMode && !buildTracesPromise) {
    buildTracesPromise = collectBuildTraces(...)
}

collectBuildTraces is skipped. The conclusion does not follow — Turbopack emits the .nft.json files and applies the include globs on its own side. The option is handled in next/dist only by collectBuildTraces, which is exactly why reading that far is misleading.

The measurement

Against a real Turbopack build of apps/community (chunkLoadingGlobal: "TURBOPACK"), not argued from source:

file covered by the '/**' key? @swc/helpers entries under esm/
next-server.js.nft.json no 3 0
server/app/admin/log/page.js.nft.json yes 1318 324

The covered one also lists the package's LICENSE — a file no tracer would ever follow. That is the glob, not tracing.

What this changes

Nothing in the build. The glob in apps/community/next.config.mjs is load-bearing: it is the only thing putting @swc/helpers/esm into the standalone tree, and without it self-hosted and Docker boards fail at request time with Cannot find module '@swc/helpers/esm/…'. MEI-120's gate on its pinned version guards something real. Both stay exactly as they are — which is the point of correcting this, since the ticket as filed proposed removing them.

Two consequences for prose:

  • The explanation for the missing migration .sql files on Vercel was wrong. They are absent because nothing imports them and nothing lists them, not because the mechanism is unavailable. MEI-133's schema check stands on its own arguments — lock contention across cold starts, function timeouts — which were always the better ones.
  • Why output: 'standalone' broke the Vercel build is now recorded as unestablished. The failure was real and reproducible; the mechanism given for it does not hold, and I could not determine the true one without a Vercel build.

The positive fact is written down beside the glob it explains, because reading next/dist alone leads to the wrong conclusion — it did so twice.

Still open

Whether Turbopack emits .nft.json when output is unset, which is today's Vercel configuration. Everything measured here came from a build with output: 'standalone', and the emission condition lives in the Rust binary. If it turns out nft files are not emitted there, the glob is inert on Vercel specifically while remaining load-bearing for Docker and self-hosting. Recorded on MEI-134; one next build with VERCEL=1 settles it.

Verification

docs:links:check, docs:index:check and site:docs:check all pass. Documentation only — no code changes.


Generated by Claude Code

Two documents said Next skips trace collection under Turbopack and
concluded the option therefore never runs. The first half is true and the
conclusion does not follow: `collectBuildTraces` is skipped, but Turbopack
emits the `.nft.json` files and applies the include globs itself.

Measured against a Turbopack build of this app rather than argued from
`next/dist`: `next-server.js.nft.json`, which the `'/**'` key does not
cover, lists three `@swc/helpers` entries and none under `esm/`; a route's
`.nft.json`, which it does cover, lists over a thousand including 324
under `esm/` and the package's `LICENSE`, a file no tracer would follow.
The glob is load-bearing, not dead code, and the gate guarding its pinned
version guards something real.

That reading also produced a false explanation for the missing migration
`.sql` files on Vercel. They are absent because nothing imports them and
nothing lists them, not because the mechanism is unavailable — the
schema-check the installer now does stands on its own arguments, which
were always the better ones. And the reason `output: 'standalone'` broke
the Vercel build is recorded as unestablished rather than explained by a
mechanism that does not hold.

The positive fact is written down beside the glob it explains, because
reading `next/dist` alone leads to the wrong conclusion twice.
@jouwdan
jouwdan merged commit 514c3dc into main Aug 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant