Menu

#274 fix(ui): gate standalone output to production so dev server boots

closed
nobody
None
2026-06-14
2026-06-12
Anonymous
No

Originally created by: Akarsh-Hegde

Problem

next dev --turbopack crashes on startup with:

TurbopackInternalError: Invalid distDirRoot: ".next". distDirRoot should not navigate out of the projectPath.

ui/next.config.ts sets output: 'standalone' unconditionally. Combined with the pinned outputFileTracingRoot / turbopack.root (both ui/), Next 16.2's Turbopack mis-resolves the dev distDir and aborts. This blocks the local hot-reload dev server (dev-start.sh window [#3] and cd ui && npm run dev).

Fix

Gate output: 'standalone' on NODE_ENV === 'production'. Standalone output is purely a production/packaging concern; it has no purpose in dev.

output: process.env.NODE_ENV === 'production' ? 'standalone' : undefined,

Why this is safe

  • npm run build runs with NODE_ENV=production → standalone bundle still emitted exactly as before. package-release.sh / install-from-bundle.sh are unaffected.
  • next dev runs with NODE_ENV=development → no standalone tracing → Turbopack boots clean.

Verification

  • next dev --turbopack✓ Ready and serves (was a hard crash before).
  • output: 'standalone' still active for production builds (NODE_ENV gate).

🤖 Generated with Claude Code

Related

Tickets: #281
Tickets: #3

Discussion

  • Anonymous

    Anonymous - 2026-06-13

    Originally posted by: Akarsh-Hegde

    Code review

    Correct, well-scoped fix for the Invalid distDirRoot ".next" Turbopack panic on next dev. Root cause (output: 'standalone' confusing Turbopack's distDir resolution against the pinned outputFileTracingRoot in dev) is the real one — this supersedes the "rm -rf ui/.next" workaround.

    ✅ Correctness

    • next dev runs with NODE_ENV=developmentoutput is undefined → no standalone → no panic.
    • next build sets NODE_ENV=productionoutput: 'standalone' → shipped bundle unchanged. The green "UI build" check confirms standalone still emits.

    🟡 One thing to keep in mind

    This now couples standalone emission to NODE_ENV being production at build time. If any build path ever invokes next build with NODE_ENV unset/overridden (some CI wrappers do), standalone silently won't emit and package-release.sh will fail at its ui/.next/standalone check. Worth a one-line comment in package-release.sh noting the dependency, or asserting NODE_ENV=production next build explicitly there.

    ⚠️ Not your PR, but blocking it

    The red Rust check is pre-existing cargo fmt drift on main (config.rs, providers/*.rs) — nothing here touches Rust. It'll stay red until the fmt fix lands on main. See the triage note; this goes green on rebase afterward.

     
  • Anonymous

    Anonymous - 2026-06-14

    Ticket changed by: Akarsh-Hegde

    • status: open --> closed
     
  • Anonymous

    Anonymous - 2026-06-14

    Originally posted by: Akarsh-Hegde

    Superior, more complete fix
    stashed on feat/otlp-ui-settings

     

Log in to post a comment.