Skip to content

Module Contains JSX Element #100

@steinalex

Description

@steinalex

Thanks for the awesome library! I've found a strange issue when running Jest tests whilst implementing Portal (on an Expo 53 application).

Details:

/<my-user-path>/node_modules/@rn-primitives/portal/dist/index.js:69
  return <>{Array.from(portalMap.values())}</>;
         ^

SyntaxError: Unexpected token '<'

When I inspect the file in my node_modules, I see JSX syntax:

function PortalHost({ name = DEFAULT_PORTAL_HOST }) {
  const portalMap = usePortal((state) => state.map).get(name) ?? /* @__PURE__ */ new Map();
  if (portalMap.size === 0) return null;
  return <>{Array.from(portalMap.values())}</>; // <---- JSX syntax compiled here
}

I'm a bit confused why this isn't being thrown during run time and only during whilst running Jest tests. Are you able to shed some light on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions