Skip to content

relay-compiler does not support JSX fragments #2280

@hisapy

Description

@hisapy

This is possibly a bug.

Given a component with a React fragments:

<Card
     // other props here
     actions={
        <>
          <Button ... />
          <Button ... />
        </>
      }
/>

, when running relay-compiler, I get the following error:

ERROR:
Parse error: SyntaxError: Unexpected token (492:13) in "app/company-constitutions/CompanyConstitutionForm.jsx"
From: CodegenRunner.compileAll
    at /Users/hisa/workspace/eljurista/node_modules/relay-compiler/bin/relay-compiler:2816:18
    at /Users/hisa/workspace/eljurista/node_modules/relay-compiler/bin/relay-compiler:2818:9
    at Set.forEach (<anonymous>)
    at ASTCache.parseFiles (/Users/hisa/workspace/eljurista/node_modules/relay-compiler/bin/relay-compiler:2811:12)
    at CodegenRunner.parseFileChanges (/Users/hisa/workspace/eljurista/node_modules/relay-compiler/bin/relay-compiler:5174:13)
    at CodegenRunner.<anonymous> (/Users/hisa/workspace/eljurista/node_modules/relay-compiler/bin/relay-compiler:5160:13)
    at Generator.next (<anonymous>)
    at step (/Users/hisa/workspace/eljurista/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/hisa/workspace/eljurista/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at <anonymous>
error Command failed with exit code 100.

This is happening with the following package versions:

yarn list --pattern "relay|babel-runtime"
yarn list v1.3.2
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]

I believe for this to work, the babel dependencies has to be updated to v7

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