feat(compiler-sfc): improve sfc source map generation
This commit is contained in:
parent
e08f6f0ede
commit
698c8d35d5
@ -255,17 +255,21 @@ function generateSourceMap(
|
||||
map.setSourceContent(filename, source)
|
||||
generated.split(splitRE).forEach((line, index) => {
|
||||
if (!emptyRE.test(line)) {
|
||||
map.addMapping({
|
||||
source: filename,
|
||||
original: {
|
||||
line: index + 1 + lineOffset,
|
||||
column: 0
|
||||
},
|
||||
generated: {
|
||||
line: index + 1,
|
||||
column: 0
|
||||
}
|
||||
})
|
||||
const originalLine = index + 1 + lineOffset
|
||||
const generatedLine = index + 1
|
||||
for (let i = 0; i < line.length; i++) {
|
||||
map.addMapping({
|
||||
source: filename,
|
||||
original: {
|
||||
line: originalLine,
|
||||
column: i
|
||||
},
|
||||
generated: {
|
||||
line: generatedLine,
|
||||
column: i
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
return JSON.parse(map.toString())
|
||||
|
Loading…
x
Reference in New Issue
Block a user