]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf(compiler-sfc): only add character mapping if not whitespace
authorEvan You <yyx990803@gmail.com>
Thu, 7 May 2020 13:38:49 +0000 (09:38 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 7 May 2020 14:32:54 +0000 (10:32 -0400)
packages/compiler-sfc/src/parse.ts

index cc6e4a8e22a01b73ede2f6b4fb0d7ca9afb811a7..4b1c972f8d05613bbf74298ad65b0731803a0a09 100644 (file)
@@ -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
+            }
+          })
+        }
       }
     }
   })