From: Evan You Date: Thu, 7 May 2020 13:38:49 +0000 (-0400) Subject: perf(compiler-sfc): only add character mapping if not whitespace X-Git-Tag: v3.0.0-beta.10~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f69167e889f2817138629a04c01c6baf565d485;p=thirdparty%2Fvuejs%2Fcore.git perf(compiler-sfc): only add character mapping if not whitespace --- 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 + } + }) + } } } })