What kind of issue is this?
Link to repro
https://stackblitz.com/edit/vitejs-vite-9eantx6h
Repro steps
React Compiler adds an import declaration to the top of the module, before leading comments.
React Compiler playground
While this works file with Babel's JSX transform (playground), other tools don't respect JSX pragma (e.g. @jsxImportSource) comments that come after any code statement, including imports.
Oxc playground
SWC playground
TypeScript playground
It's common to integrate React Compiler into a build process that handles JSX transform using Oxc/SWC. And current compiler's behavior prevents code with JSX pragmas from working in such a setup.
React Compiler should probably keep JSX pragmas and other leading comments/directives at the top.
How often does this bug happen?
Every time
What version of React are you using?
19.2.6
What version of React Compiler are you using?
1.0.0
What kind of issue is this?
Link to repro
https://stackblitz.com/edit/vitejs-vite-9eantx6h
Repro steps
React Compiler adds an import declaration to the top of the module, before leading comments.
React Compiler playground
While this works file with Babel's JSX transform (playground), other tools don't respect JSX pragma (e.g.
@jsxImportSource) comments that come after any code statement, including imports.Oxc playground
SWC playground
TypeScript playground
It's common to integrate React Compiler into a build process that handles JSX transform using Oxc/SWC. And current compiler's behavior prevents code with JSX pragmas from working in such a setup.
React Compiler should probably keep JSX pragmas and other leading comments/directives at the top.
How often does this bug happen?
Every time
What version of React are you using?
19.2.6
What version of React Compiler are you using?
1.0.0