@@ -147,6 +147,15 @@ export async function createPluginContainer(
147
147
const debugPluginTransform = createDebugger ( 'vite:plugin-transform' , {
148
148
onlyWhenFocused : 'vite:plugin'
149
149
} )
150
+ const debugSourcemapCombineFlag = 'vite:sourcemap-combine'
151
+ const isDebugSourcemapCombineFocused = process . env . DEBUG ?. includes (
152
+ debugSourcemapCombineFlag
153
+ )
154
+ const debugSourcemapCombineFilter =
155
+ process . env . DEBUG_VITE_SOURCEMAP_COMBINE_FILTER
156
+ const debugSourcemapCombine = createDebugger ( 'vite:sourcemap-combine' , {
157
+ onlyWhenFocused : true
158
+ } )
150
159
151
160
// ---------------------------------------------------------------------------
152
161
@@ -424,6 +433,16 @@ export async function createPluginContainer(
424
433
}
425
434
426
435
_getCombinedSourcemap ( createIfNull = false ) {
436
+ if (
437
+ debugSourcemapCombineFilter &&
438
+ this . filename . includes ( debugSourcemapCombineFilter )
439
+ ) {
440
+ debugSourcemapCombine ( '----------' , this . filename )
441
+ debugSourcemapCombine ( this . combinedMap )
442
+ debugSourcemapCombine ( this . sourcemapChain )
443
+ debugSourcemapCombine ( '----------' )
444
+ }
445
+
427
446
let combinedMap = this . combinedMap
428
447
for ( let m of this . sourcemapChain ) {
429
448
if ( typeof m === 'string' ) m = JSON . parse ( m )
@@ -613,6 +632,10 @@ export async function createPluginContainer(
613
632
if ( result . code !== undefined ) {
614
633
code = result . code
615
634
if ( result . map ) {
635
+ if ( isDebugSourcemapCombineFocused ) {
636
+ // @ts -expect-error inject plugin name for debug purpose
637
+ result . map . name = plugin . name
638
+ }
616
639
ctx . sourcemapChain . push ( result . map )
617
640
}
618
641
}
0 commit comments