fix(compiler-sfc): duplicated injected css var with repeated vars in style (#2802)

This commit is contained in:
patak
2021-07-15 22:45:37 +02:00
committed by GitHub
parent b31712ecc5
commit 29010501cc
3 changed files with 44 additions and 1 deletions

View File

@@ -37,7 +37,10 @@ export function parseCssVars(sfc: SFCDescriptor): string[] {
sfc.styles.forEach(style => {
let match
while ((match = cssVarRE.exec(style.content))) {
vars.push(match[1] || match[2] || match[3])
const variable = match[1] || match[2] || match[3]
if (!vars.includes(variable)) {
vars.push(variable)
}
}
})
return vars