From 4e5fb0fb1ed27d88aba8bef90eb39d206a3971c1 Mon Sep 17 00:00:00 2001 From: arlo Date: Tue, 20 Oct 2026 10:52:02 +0800 Subject: [PATCH] fix(rolldown): match unnamed chunks across compared sessions Co-Authored-By: Claude Opus 5.5 (1M context) --- .../rpc/functions/rolldown-get-session-compare-details.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/rolldown/src/node/rpc/functions/rolldown-get-session-compare-details.ts b/packages/rolldown/src/node/rpc/functions/rolldown-get-session-compare-details.ts index 51820a8ee..3a8f4ec7f 100644 --- a/packages/rolldown/src/node/rpc/functions/rolldown-get-session-compare-details.ts +++ b/packages/rolldown/src/node/rpc/functions/rolldown-get-session-compare-details.ts @@ -137,11 +137,13 @@ function getChunkSize(reader: RolldownEventsReader, chunk: RolldownChunkInfo | u } function getChunkKey(chunk: RolldownChunkInfo) { - if (chunk.name) + // Bracketed names are guessed (`[_]`) and change whenever + // a module is added or removed, so match those chunks by entry or first module instead + if (chunk.name && !/^\[.*\]$/.test(chunk.name)) return `name:${chunk.name}` if (chunk.entry_module) return `entry:${chunk.entry_module}` - return `modules:${chunk.modules.toSorted((a, b) => a.localeCompare(b)).join('\0')}` + return `module:${chunk.modules[0] ?? chunk.chunk_id}` } function getPackageImporters(pkg: { files: PackageInfo['files'] } | undefined) {