1.5 KiB
Turbopack Dev Server Hang — @vidstack/react + Barrel Circular Import
Applies when: Next.js dev server hangs (290%+ CPU, 1GB+ RAM, no HTTP responses), or Turbopack enters infinite recompilation
Three contributing factors found:
-
Barrel self-import in features/project:
SubtitleRevisionStep.tsximportsTranscriptionEditorfrom the barrel@features/projectwhich re-exportsSubtitleRevisionStepitself, creating a circular module evaluation chain. Fix: use direct subpath import. -
FSD violation features->widgets:
SubtitleRevisionStepimportsTimelinePanelfrom@widgets/, violating FSD layer direction. Not a direct cause of hang but exacerbates module graph complexity. -
@vidstack/react internal dynamic imports: The library uses 14+ dynamic
import()calls internally. Combined with Turbopack's inability to create shared chunks between async chunks in dev mode (GitHub issue vercel/next.js#85119), this can cause pathological module duplication during HMR.
Reproduction: Issue is intermittent — most reliably triggered when editing files that import from @vidstack/react while the browser has the project wizard page open. Fresh server starts work fine.
Quick fix: Change SubtitleRevisionStep.tsx line 23 from import { TranscriptionEditor } from "@features/project" to import { TranscriptionEditor } from "@features/project/TranscriptionEditor".
Long-term: Consider upgrading to Next.js 16.2+ which includes 200+ Turbopack fixes.