Skip to content

Commit

Permalink
fix: isJsxAndNotFragment condition of isReactNode (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
peetck authored Feb 22, 2024
1 parent 9671b32 commit 67afb82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/magicString/react/isReactNode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ export default function isReactNode(node: Record<string, any>) {
node?.callee?.object?.name === 'React' && node?.callee?.property?.name === 'createElement'

const isJsxAndNotFragment =
node?.callee?.name?.include?.('jsx') && node?.arguments?.[0]?.name !== 'Fragment'
(node?.callee?.name === 'jsxDEV' ||
node?.callee?.name === 'jsx' ||
node?.callee?.name === 'jsxs') &&
node?.arguments?.[0]?.name !== 'Fragment'

return isReactCreateElement || isJsxAndNotFragment
}

0 comments on commit 67afb82

Please sign in to comment.