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
Originally posted by: Akarsh-Hegde
Code review
Correct, well-scoped fix for the
Invalid distDirRoot ".next"Turbopack panic onnext dev. Root cause (output: 'standalone'confusing Turbopack's distDir resolution against the pinnedoutputFileTracingRootin dev) is the real one — this supersedes the "rm -rf ui/.next" workaround.✅ Correctness
next devruns withNODE_ENV=development→outputisundefined→ no standalone → no panic.next buildsetsNODE_ENV=production→output: '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_ENVbeingproductionat build time. If any build path ever invokesnext buildwithNODE_ENVunset/overridden (some CI wrappers do), standalone silently won't emit andpackage-release.shwill fail at itsui/.next/standalonecheck. Worth a one-line comment inpackage-release.shnoting the dependency, or assertingNODE_ENV=production next buildexplicitly there.⚠️ Not your PR, but blocking it
The red Rust check is pre-existing
cargo fmtdrift onmain(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.Ticket changed by: Akarsh-Hegde
Originally posted by: Akarsh-Hegde
Superior, more complete fix
stashed on feat/otlp-ui-settings