advancedChunks groups silently deadlock module evaluation (entry fetched, no errors, app never mounts)
Describe the bug
With output.advancedChunks configured in build.rolldownOptions (Vite 8.2.1 forwards this to rolldown 1.2.4), certain group combinations produce a build that silently deadlocks module evaluation at runtime: the entry chunk is fetched with HTTP 200, there are zero console errors / pageerrors / unhandled rejections, the main thread stays responsive, and resource timings show all assets loaded — but no module body side effects ever execute (no top-level assignments, app never mounts). The page renders only its static HTML shell and hangs that way permanently, 100% reproducible.
An A/B test on two identical clean worktrees differing only in vite.config.ts chunking confirms it: config A (no advancedChunks) boots to interactive in ~2s; config B (advancedChunks below) hangs forever.
Reproduction
App profile: Svelte 5 + Three.js SPA, ~520 modules, Windows 11, Chrome (latest) — also reproduced headless via Playwright.
Config B (HANGS):
build: {
rolldownOptions: {
output: {
advancedChunks: {
groups: [
{ name: 'three', test: /node_modules[\\/]three[\\/]/ },
{ name: 'svelte-vendor', test: /node_modules[\\/]svelte[\\/]/ },
{ name: 'engine-three', test: /[\\/]src[\\/]lib[\\/]engine[\\/]|[\\/]src[\\/]lib[\\/]journey[\\/](point-color|focus-pocket|route-trace|semantic-overlay|canvas-hit|canvas-node|thread-inspector-webgl|arrival-handoff|focus-anchor|webgl-utils|canvas-interaction)|[\\/]src[\\/]lib[\\/]utils[\\/](camera-math-utils|three-textures|ui-presentation-three)|[\\/]src[\\/]lib[\\/]ui[\\/]cluster-labels/ },
{ name: 'mode-transition-deps', test: /[\\/]src[\\/]lib[\\/]stores[\\/](navigation\.svelte\.ts|navigation[\\/]|search\.svelte|focus\.svelte|journey\.svelte)|[\\/]src[\\/]lib[\\/]orchestration[\\/]|[\\/]src[\\/]lib[\\/]journey[\\/]|[\\/]src[\\/]lib[\\/]search[\\/]|navigation-actions/ }
]
}
}
}
}Config A (WORKS): same file without the advancedChunks block (function-form manualChunks is used instead — note it is silently ignored by the Vite compat layer, see notes).
Observations
- Removing groups narrows the trigger. A minimal single-group config (
engine-threepath group only) boots fine — the hang appears when vendor groups (three,svelte-vendor) and/or the broad app-code group (mode-transition-deps) participate, i.e. something about regrouping the runtime/vendor closure into named chunks. - Deadlock, not crash:
window.onerror,unhandledrejection, console, and CDPRuntime.exceptionThrownare all silent. Main thread answersevaluate()normally. - Entry
<script type="module">loads (HTTP 200, resource timing present), its static import subgraph all returns 200, yet execution never reaches the entry body. - Suspect: chunk-import cycle introduced by the grouping where module instantiation order leaves a binding uninitialized and evaluation of the cycle aborts without surfacing an error (TDZ-style failure swallowed during module graph instantiation?), possibly involving the
rolldown-runtimehelper chunk when it is itself regrouped/referenced across grouped chunks.
Notes / related
- Function-form
output.manualChunksin the same setup is silently ignored (not forwarded by Vite 8's rollupOptions compat layer) — discovered while working around this. Worth either forwarding or warning. - Happy to provide the full built output, source repo access, or a reduced repo if useful. A debug-mode flag that detects "entry fetched but zero modules evaluated" or surfaces chunk-graph cycles during
advancedChunksassignment would have saved us a long night.
Versions
- vite: 8.2.1 (rolldown-vite distribution)
- rolldown: 1.2.4
- OS: Windows 11 (also observed via headless Chromium under Playwright)
Source: rolldown/rolldown