Explorar o código

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

Evan You %!s(int64=6) %!d(string=hai) anos
pai
achega
2f69167e88
Modificáronse 1 ficheiros con 13 adicións e 11 borrados
  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
+            }
+          })
+        }
       }
     }
   })