@@ -90,21 +90,25 @@ const transformJSXElement = (
9090 ---> {{ default: () => [a, b], ...slots }}
9191 ---> {[a, b]}
9292 */
93- VNodeChild = isComponent ? t . objectExpression ( [
94- ! ! children . length && t . objectProperty (
95- t . identifier ( 'default' ) ,
96- t . arrowFunctionExpression ( [ ] , t . arrayExpression ( buildIIFE ( path , children ) ) ) ,
97- ) ,
98- ...( slots ? (
99- t . isObjectExpression ( slots )
100- ? ( slots ! as t . ObjectExpression ) . properties
101- : [ t . spreadElement ( slots ! ) ]
102- ) : [ ] ) ,
103- optimize && t . objectProperty (
104- t . identifier ( '_' ) ,
105- t . numericLiteral ( slotFlag ) ,
106- ) ,
107- ] . filter ( Boolean as any ) ) : t . arrayExpression ( children ) ;
93+ VNodeChild = isComponent
94+ ? children . length
95+ ? t . objectExpression ( [
96+ ! ! children . length && t . objectProperty (
97+ t . identifier ( 'default' ) ,
98+ t . arrowFunctionExpression ( [ ] , t . arrayExpression ( buildIIFE ( path , children ) ) ) ,
99+ ) ,
100+ ...( slots ? (
101+ t . isObjectExpression ( slots )
102+ ? ( slots ! as t . ObjectExpression ) . properties
103+ : [ t . spreadElement ( slots ! ) ]
104+ ) : [ ] ) ,
105+ optimize && t . objectProperty (
106+ t . identifier ( '_' ) ,
107+ t . numericLiteral ( slotFlag ) ,
108+ ) ,
109+ ] . filter ( Boolean as any ) )
110+ : slots
111+ : t . arrayExpression ( children ) ;
108112 } else if ( children . length === 1 ) {
109113 /*
110114 <A>{a}</A> or <A>{() => a}</A>
0 commit comments