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