From 2f69167e889f2817138629a04c01c6baf565d485 Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 7 May 2020 09:38:49 -0400 Subject: [PATCH] perf(compiler-sfc): only add character mapping if not whitespace --- packages/compiler-sfc/src/parse.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/compiler-sfc/src/parse.ts b/packages/compiler-sfc/src/parse.ts index cc6e4a8e22..4b1c972f8d 100644 --- a/packages/compiler-sfc/src/parse.ts +++ b/packages/compiler-sfc/src/parse.ts @@ -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 + } + }) + } } } }) -- 2.47.3