Skip to content

Commit

Permalink
perf(compiler-sfc): only add character mapping if not whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 7, 2020
1 parent 675330b commit 2f69167
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/compiler-sfc/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,19 @@ function generateSourceMap(
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
}
})
if (!/\s/.test(line[i])) {
map.addMapping({
source: filename,
original: {
line: originalLine,
column: i
},
generated: {
line: generatedLine,
column: i
}
})
}
}
}
})
Expand Down

0 comments on commit 2f69167

Please sign in to comment.