// walk further
if (child.type === NodeTypes.ELEMENT) {
+ const isComponent = child.tagType === ElementTypes.COMPONENT
+ if (isComponent) {
+ context.scopes.vSlot++
+ }
walk(child, context)
+ if (isComponent) {
+ context.scopes.vSlot--
+ }
} else if (child.type === NodeTypes.FOR) {
// Do not hoist v-for single child because it has to be a block
walk(child, context, child.children.length === 1)
* This optimization is only performed in Node.js.
*/
export const stringifyStatic: HoistTransform = (children, context, parent) => {
- if (
- parent.type === NodeTypes.ELEMENT &&
- (parent.tagType === ElementTypes.COMPONENT ||
- parent.tagType === ElementTypes.TEMPLATE)
- ) {
+ // bail stringification for slot content
+ if (context.scopes.vSlot > 0) {
return
}