Skip to content

Commit 2f69167

Browse files
committedMay 7, 2020
perf(compiler-sfc): only add character mapping if not whitespace
1 parent 675330b commit 2f69167

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed
 

‎packages/compiler-sfc/src/parse.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,19 @@ function generateSourceMap(
258258
const originalLine = index + 1 + lineOffset
259259
const generatedLine = index + 1
260260
for (let i = 0; i < line.length; i++) {
261-
map.addMapping({
262-
source: filename,
263-
original: {
264-
line: originalLine,
265-
column: i
266-
},
267-
generated: {
268-
line: generatedLine,
269-
column: i
270-
}
271-
})
261+
if (!/\s/.test(line[i])) {
262+
map.addMapping({
263+
source: filename,
264+
original: {
265+
line: originalLine,
266+
column: i
267+
},
268+
generated: {
269+
line: generatedLine,
270+
column: i
271+
}
272+
})
273+
}
272274
}
273275
}
274276
})

0 commit comments

Comments
 (0)