Skip to content

Commit

Permalink
fix: isReactNode check include jsx (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
peetck authored Feb 22, 2024
1 parent d860bb9 commit f55bf24
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/magicString/react/isReactNode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ export default function isReactNode(node: Record<string, any>) {
node?.callee?.object?.name === 'React' && node?.callee?.property?.name === 'createElement'

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

return isReactCreateElement || isJsxAndNotFragment
}

0 comments on commit f55bf24

Please sign in to comment.