Skip to content

Turbopack: Path doubling with outputFileTracingRoot in monorepo causes vercel build failure #88579

@domhede

Description

@domhede

Link to the code that reproduces this issue

https://github.com/domhede/turbopack-monorepo-repro

To Reproduce

  1. Clone the repo: git clone https://github.com/domhede/turbopack-monorepo-repro
  2. Install dependencies: yarn install
  3. Navigate to frontend: cd apps/frontend
  4. Run Vercel build: npx vercel build

Current vs. Expected behavior

Expected: Build succeeds and produces a working standalone output.

Actual: Build fails with path doubling error:

Error: ENOENT: no such file or directory, lstat
'/path/to/apps/frontend/apps/frontend/.next/routes-manifest.json'

The path apps/frontend/ is doubled because outputFileTracingRoot causes the build to prepend the relative path from monorepo root, but we're already in that directory.

Provide environment information

  • Node.js: 24.x
  • Next.js: 15.3.3
  • Vercel CLI: 50.4.0

Which area(s) are affected? (Select all that apply)

Turbopack, Output (standalone)

Which stage(s) are affected? (Select all that apply)

vercel build

Additional context

next.config.js:

const path = require("path");

module.exports = {
  turbopack: {
    root: path.resolve(__dirname, "../.."),
  },
  outputFileTracingRoot: path.resolve(__dirname, "../.."),
  output: "standalone",
};

Notes:

  • Without outputFileTracingRoot: turbopack.root is ignored and module resolution fails for workspace packages
  • With outputFileTracingRoot: Path doubling occurs during the build
  • There is currently no working configuration for Turbopack production builds in monorepos with shared packages
  • Standard next build works fine; the issue only occurs with vercel build

Metadata

Metadata

Assignees

No one assigned

    Labels

    OutputRelated to the the output configuration option.TurbopackRelated to Turbopack with Next.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions