Преглед изворни кода

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

Evan You пре 6 година
родитељ
комит
2f69167e88
1 измењених фајлова са 13 додато и 11 уклоњено
  1. 13 11
      packages/compiler-sfc/src/parse.ts

+ 13 - 11
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
+            }
+          })
+        }
       }
     }
   })