File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,18 @@ function generateName(input) {
19
19
return name [ 0 ] . toUpperCase ( ) + name . slice ( 1 ) ;
20
20
}
21
21
22
- function extractSourceMaps ( asset , sourceMap ) {
23
- if ( ! sourceMap ) return ;
22
+ function extractSourceMaps ( projectRoot , asset , originalSourceMap , sourceMap ) {
23
+ if ( ! sourceMap ) return originalSourceMap ;
24
24
25
25
sourceMap . sources = [ asset . filePath ] ;
26
26
27
- const map = new SourceMap ( ) ;
27
+ const map = new SourceMap ( projectRoot ) ;
28
28
map . addVLQMap ( sourceMap ) ;
29
29
30
+ if ( originalSourceMap ) {
31
+ map . extends ( originalSourceMap . toBuffer ( ) ) ;
32
+ }
33
+
30
34
return map ;
31
35
}
32
36
@@ -76,13 +80,23 @@ exports.default = new Transformer({
76
80
type : 'js' ,
77
81
content : js . code ,
78
82
uniqueKey : `${ asset . id } -js` ,
79
- map : extractSourceMaps ( asset , js . map ) ,
83
+ map : extractSourceMaps (
84
+ options . projectRoot ,
85
+ asset ,
86
+ originalSourceMap ,
87
+ js . map ,
88
+ ) ,
80
89
} ,
81
90
Boolean ( css && css . code ) && {
82
91
type : 'css' ,
83
92
content : css . code ,
84
93
uniqueKey : `${ asset . id } -css` ,
85
- map : extractSourceMaps ( asset , css . map ) ,
94
+ map : extractSourceMaps (
95
+ options . projectRoot ,
96
+ asset ,
97
+ originalSourceMap ,
98
+ css . map ,
99
+ ) ,
86
100
} ,
87
101
] . filter ( Boolean ) ;
88
102
} ,
You can’t perform that action at this time.
0 commit comments