@@ -310,7 +310,19 @@ const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
310310 ) ;
311311 } else {
312312 // single no need for a mergeProps call
313- propsExpression = mergeArgs [ 0 ] ;
313+ if ( isComponent ) {
314+ // createVNode already normalizes props
315+ propsExpression = mergeArgs [ 0 ] ;
316+ } else {
317+ propsExpression = t . callExpression (
318+ createIdentifier ( state , 'normalizeProps' ) ,
319+ [
320+ t . callExpression ( createIdentifier ( state , 'guardReactiveProps' ) , [
321+ mergeArgs [ 0 ] ,
322+ ] ) ,
323+ ]
324+ ) ;
325+ }
314326 }
315327 } else if ( properties . length ) {
316328 // single no need for spread
@@ -320,6 +332,27 @@ const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
320332 propsExpression = t . objectExpression (
321333 dedupeProperties ( properties , mergeProps )
322334 ) ;
335+ for ( let i = 0 ; i < propsExpression . properties . length ; i ++ ) {
336+ const property = propsExpression . properties [ i ] ;
337+ if (
338+ ! t . isObjectProperty ( property ) ||
339+ ! t . isStringLiteral ( property . key ) ||
340+ ! t . isExpression ( property . value ) ||
341+ isConstant ( property . value )
342+ )
343+ continue ;
344+ if ( property . key . value === 'class' ) {
345+ property . value = t . callExpression (
346+ createIdentifier ( state , 'normalizeClass' ) ,
347+ [ property . value ]
348+ ) ;
349+ } else if ( property . key . value === 'style' ) {
350+ property . value = t . callExpression (
351+ createIdentifier ( state , 'normalizeStyle' ) ,
352+ [ property . value ]
353+ ) ;
354+ }
355+ }
323356 }
324357 }
325358
@@ -553,7 +586,7 @@ const transformJSXElement = (
553586 }
554587
555588 const createVNode = t . callExpression (
556- createIdentifier ( state , 'createVNode' ) ,
589+ createIdentifier ( state , isComponent ? 'createVNode' : 'createElementVNode ') ,
557590 [
558591 tag ,
559592 props ,
0 commit comments