perf(compiler-sfc): only add character mapping if not whitespace

This commit is contained in:
Evan You 2020-05-07 09:38:49 -04:00
parent 675330ba54
commit 2f69167e88

View File

@ -258,6 +258,7 @@ function generateSourceMap(
const originalLine = index + 1 + lineOffset const originalLine = index + 1 + lineOffset
const generatedLine = index + 1 const generatedLine = index + 1
for (let i = 0; i < line.length; i++) { for (let i = 0; i < line.length; i++) {
if (!/\s/.test(line[i])) {
map.addMapping({ map.addMapping({
source: filename, source: filename,
original: { original: {
@ -271,6 +272,7 @@ function generateSourceMap(
}) })
} }
} }
}
}) })
return JSON.parse(map.toString()) return JSON.parse(map.toString())
} }