vitejs / vitejs/vite-plugin-react
Enabling React Compiler breaks JSX pragma handling
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 269
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 19
Description
Related plugins
Describe the bug
React Compiler integration, as documented by the plugin, is not compatible with JSX pragma usage (e.g Emotion css prop).
React Compiler adds an import statement at the top of the file (playground).
This causes Oxc to skip the pragma (playground).
Interestingly, Babel handles this case fine (playground), while TypeScript matches Oxc's behavior (playground).
Reproduction
https://stackblitz.com/edit/vitejs-vite-9eantx6h
Steps to reproduce
No response
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 22.22.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@vitejs/plugin-react: ^6.0.1 => 6.0.1
vite: ^8.0.12 => 8.0.12
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked StackBlitz reproduction first, then inspect the plugin-react React Compiler integration and its JSX pragma handling. The issue is resolved when enabling React Compiler preserves JSX pragma behavior, including custom JSX or Emotion css prop usage, and the reproduction no longer fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100