diff --git a/packages/compiler-sfc/src/parse.ts b/packages/compiler-sfc/src/parse.ts index 04310acbfa2..cc6e4a8e22a 100644 --- a/packages/compiler-sfc/src/parse.ts +++ b/packages/compiler-sfc/src/parse.ts @@ -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())