Skip to content

Commit fdb6006

Browse files
committed
avoid generating empty ssrNode
1 parent 7cf1e65 commit fdb6006

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/server/optimizing-compiler/codegen.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ function genSSRNode (el, state) {
8989
}
9090

9191
function genStringChildren (el, state) {
92-
return `[_ssrNode(${flattenSegments(childrenToSegments(el, state))})]`
92+
return el.children.length
93+
? `[_ssrNode(${flattenSegments(childrenToSegments(el, state))})]`
94+
: ''
9395
}
9496

9597
function genStringElement (el, state, stringifyChildren) {
@@ -106,6 +108,7 @@ function genStringElement (el, state, stringifyChildren) {
106108
}
107109

108110
function elementToSegments (el, state): Array<StringSegment> {
111+
// v-for / v-if
109112
if (el.for && !el.forProcessed) {
110113
el.forProcessed = true
111114
return [{
@@ -120,6 +123,9 @@ function elementToSegments (el, state): Array<StringSegment> {
120123
}]
121124
}
122125

126+
// v-html / v-text
127+
console.log(el)
128+
123129
const openSegments = elementToOpenTagSegments(el, state)
124130
const childrenSegments = childrenToSegments(el, state)
125131
const { isUnaryTag } = state.options

0 commit comments

Comments
 (0)