File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -193,14 +193,23 @@ export async function transformMain(
193
193
194
194
let resolvedMap : RawSourceMap | undefined = undefined
195
195
if ( options . sourceMap ) {
196
- if ( scriptMap && templateMap ) {
197
- // if the template is inlined into the main module (indicated by the presence
198
- // of templateMap), we need to concatenate the two source maps.
199
-
196
+ // the mappings of the source map for the inlined template should be moved
197
+ // because the position does not include the script tag part.
198
+ // we also concatenate the two source maps while doing that.
199
+ if ( templateMap ) {
200
+ const from = scriptMap ?? {
201
+ file : filename ,
202
+ sourceRoot : '' ,
203
+ version : 3 ,
204
+ sources : [ ] ,
205
+ sourcesContent : [ ] ,
206
+ names : [ ] ,
207
+ mappings : '' ,
208
+ }
200
209
const gen = fromMap (
201
210
// version property of result.map is declared as string
202
211
// but actually it is `3`
203
- scriptMap as Omit < RawSourceMap , 'version' > as TraceEncodedSourceMap ,
212
+ from as Omit < RawSourceMap , 'version' > as TraceEncodedSourceMap ,
204
213
)
205
214
const tracer = new TraceMap (
206
215
// same above
@@ -228,8 +237,7 @@ export async function transformMain(
228
237
// of the main module compile result, which has outdated sourcesContent.
229
238
resolvedMap . sourcesContent = templateMap . sourcesContent
230
239
} else {
231
- // if one of `scriptMap` and `templateMap` is empty, use the other one
232
- resolvedMap = scriptMap ?? templateMap
240
+ resolvedMap = scriptMap
233
241
}
234
242
}
235
243
You can’t perform that action at this time.
0 commit comments