Browse Source

fix(compiler-sfc): avoid duplicated unref import for vapor mode (#14267)

close #14265
edison 3 months ago
parent
commit
f9e87cecb6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/compiler-sfc/src/compileScript.ts

+ 6 - 1
packages/compiler-sfc/src/compileScript.ts

@@ -1042,7 +1042,12 @@ export function compileScript(
       // avoid duplicated unref import
       // as this may get injected by the render function preamble OR the
       // css vars codegen
-      if (helpers && helpers.has(UNREF)) {
+      if (
+        helpers &&
+        (helpers.has(UNREF) ||
+          // vapor compiler uses 'unref' instead of UNREF
+          helpers.has('unref'))
+      ) {
         ctx.helperImports.delete('unref')
       }
       returned = code