fix(web): align outputFileTracingRoot with turbopack.root for monorepo#2041
Merged
jeanduplessis merged 2 commits intomainfrom Apr 6, 2026
Merged
fix(web): align outputFileTracingRoot with turbopack.root for monorepo#2041jeanduplessis merged 2 commits intomainfrom
jeanduplessis merged 2 commits intomainfrom
Conversation
After the monorepo migration, turbopack.root pointed to the workspace root but outputFileTracingRoot was not set, causing Next.js to default it to the apps/web directory. This mismatch breaks the build because Next.js requires both values to agree and cannot resolve the next package from the app directory alone. Extract a shared monorepoRoot constant and use it for both settings.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Reviewed by gpt-5.4-20260305 · 91,654 tokens |
…must be set vercel build sets NEXT_PRIVATE_OUTPUT_TRACE_ROOT to the project directory (apps/web), which becomes the default outputFileTracingRoot. If only turbopack.root is set to the monorepo root, the two values diverge and Next.js overrides turbopack.root with outputFileTracingRoot, breaking next/package.json resolution.
jeanduplessis
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
outputFileTracingRootandturbopack.rootdiverging duringvercel build --prod.vercel buildsetsNEXT_PRIVATE_OUTPUT_TRACE_ROOTto the project directory (apps/web), which becomes the defaultoutputFileTracingRoot. When onlyturbopack.rootwas set to the monorepo root (../..), Next.js detected a mismatch and overrodeturbopack.rootwith the wrongoutputFileTracingRootvalue, causingnext/package.jsonresolution to fail.outputFileTracingRootandturbopack.rootto the same monorepo root (resolve(import.meta.dirname, '../..')), ensuring they stay in sync regardless of the Vercel CLI's default.Verification
buildcheck: pass (pnpm run build/next build)typecheckcheck: passlintcheck: passpackages/next/src/server/config.ts) to confirm that explicitoutputFileTracingRootoverrides theNEXT_PRIVATE_OUTPUT_TRACE_ROOTenv var default, and that matching values bypass the "both set but differ" warning.Visual Changes
N/A
Reviewer Notes
vercel buildCLI does NOT setlink.repoRootwhen using prebuilt deploys viavercel link+vercel build --prodin CI, soNEXT_PRIVATE_OUTPUT_TRACE_ROOTdefaults to the CWD (apps/web), not the monorepo root.outputFileTracingRootandturbopack.rootare set but differ, Next.js warns and usesoutputFileTracingRoot, overridingturbopack.root. This is why only settingturbopack.rootwas insufficient.NEXT_ADAPTER_PATH) is NOT enabled for Next.js 16.1.6 (minimum isv16.2.0-canary.28), so no adapter-level config override is in play.Built for John Fawcett by Kilo for Slack