From df48eec42cfbcf0648ba8ed85780cfd513eb0696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Wed, 28 Dec 2022 14:57:01 +0800 Subject: [PATCH] fix(compiler-sfc): remove comma of macro definition closes #7422 --- packages/compiler-sfc/src/compileScript.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 74cbb5396ae..36d28dcdf16 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -1219,12 +1219,12 @@ export function compileScript( } else { let start = decl.start! + startOffset let end = decl.end! + startOffset - if (i === 0) { - // first one, locate the start of the next - end = node.declarations[i + 1].start! + startOffset - } else { - // not first one, locate the end of the prev + if (i === total - 1) { + // last one, locate the end of the prev start = node.declarations[i - 1].end! + startOffset + } else { + // not last one, locate the start of the next + end = node.declarations[i + 1].start! + startOffset } s.remove(start, end) left--