fix(ssr): fix ssr scopeId on component root

This commit is contained in:
Evan You
2020-06-27 00:25:07 -04:00
parent 978d9522e8
commit afe13e0584
7 changed files with 137 additions and 46 deletions

View File

@@ -204,12 +204,15 @@ export function generate(
}
// enter render function
if (genScopeId && !ssr) {
push(`const render = ${PURE_ANNOTATION}_withId(`)
}
if (!ssr) {
if (genScopeId) {
push(`const render = ${PURE_ANNOTATION}_withId(`)
}
push(`function render(_ctx, _cache) {`)
} else {
if (genScopeId) {
push(`const ssrRender = ${PURE_ANNOTATION}_withId(`)
}
push(`function ssrRender(_ctx, _push, _parent, _attrs) {`)
}
indent()
@@ -272,7 +275,7 @@ export function generate(
deindent()
push(`}`)
if (genScopeId && !ssr) {
if (genScopeId) {
push(`)`)
}