Browse Source

fix(ssr): avoid ast.helpers duplication (#6664)

Anthony Fu 3 năm trước cách đây
mục cha
commit
57ffc3e546
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      packages/compiler-ssr/src/ssrCodegenTransform.ts

+ 4 - 3
packages/compiler-ssr/src/ssrCodegenTransform.ts

@@ -48,9 +48,10 @@ export function ssrCodegenTransform(ast: RootNode, options: CompilerOptions) {
     context.body.push(
       createCompoundExpression([`const _cssVars = { style: `, varsExp, `}`])
     )
-    Array.from(cssContext.helpers.keys()).forEach(helper =>
-      ast.helpers.push(helper)
-    )
+    Array.from(cssContext.helpers.keys()).forEach(helper => {
+      if (!ast.helpers.includes(helper))
+        ast.helpers.push(helper)
+    })
   }
 
   const isFragment =