fix(compiler-ssr): fix SSR issue when dynamic and static class co-exist (#2354)
This commit is contained in:
@@ -15,8 +15,8 @@ export const ssrInjectCssVars: NodeTransform = (node, context) => {
|
||||
return
|
||||
}
|
||||
|
||||
// _cssVars is initailized once per render function
|
||||
// the code is injected in ssrCodegenTrasnform when creating the
|
||||
// _cssVars is initialized once per render function
|
||||
// the code is injected in ssrCodegenTransform when creating the
|
||||
// ssr transform context
|
||||
if (node.type === NodeTypes.ROOT) {
|
||||
context.identifiers._cssVars = 1
|
||||
|
||||
@@ -324,9 +324,10 @@ function removeStaticBinding(
|
||||
tag: TemplateLiteral['elements'],
|
||||
binding: string
|
||||
) {
|
||||
const i = tag.findIndex(
|
||||
e => typeof e === 'string' && e.startsWith(` ${binding}=`)
|
||||
)
|
||||
const regExp = new RegExp(`^ ${binding}=".+"$`)
|
||||
|
||||
const i = tag.findIndex(e => typeof e === 'string' && regExp.test(e))
|
||||
|
||||
if (i > -1) {
|
||||
tag.splice(i, 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user