Skip to content

Commit 6bd7543

Browse files
webfansplzclaude
andauthored
fix(rolldown): match unnamed chunks across compared sessions (#614)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent d2099f0 commit 6bd7543

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/rolldown/src/node/rpc/functions/rolldown-get-session-compare-details.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ function getChunkSize(reader: RolldownEventsReader, chunk: RolldownChunkInfo | u
137137
}
138138

139139
function getChunkKey(chunk: RolldownChunkInfo) {
140-
if (chunk.name)
140+
// Bracketed names are guessed (`[<first module>_<module count>]`) and change whenever
141+
// a module is added or removed, so match those chunks by entry or first module instead
142+
if (chunk.name && !/^\[.*\]$/.test(chunk.name))
141143
return `name:${chunk.name}`
142144
if (chunk.entry_module)
143145
return `entry:${chunk.entry_module}`
144-
return `modules:${chunk.modules.toSorted((a, b) => a.localeCompare(b)).join('\0')}`
146+
return `module:${chunk.modules[0] ?? chunk.chunk_id}`
145147
}
146148

147149
function getPackageImporters(pkg: { files: PackageInfo['files'] } | undefined) {

0 commit comments

Comments
 (0)