Skip to content

Commit e9b256d

Browse files
danielroelogaretm
andauthored
fix: preserve sourcemap mappings for chunks containing user code (#4450)
Co-authored-by: Abdelrahman Awad <me@awad.dev>
1 parent 08170d1 commit e9b256d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/rollup/plugins/sourcemap-min.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ export function sourcemapMininify() {
1515
}
1616
// Parse sourcemap
1717
const sourcemap: ExistingRawSourceMap = JSON.parse(asset.source);
18-
// Only process sourcemaps with node_module sources
18+
// Only wipe mappings when every source is from node_modules, so that
19+
// chunks mixing user code with hoisted library code keep their mappings
1920
if (
20-
!(sourcemap.sources || []).some((s) => s.includes("node_modules"))
21+
!(sourcemap.sources || []).every((s) => s.includes("node_modules"))
2122
) {
2223
continue;
2324
}

0 commit comments

Comments
 (0)