Enabling React Compiler breaks JSX pragma handling

Open
#1,224 7 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
react, typescript
Domain
frontend, tooling

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.

Description

bug: upstream plugin: react
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
Dominant language
TypeScript
Stars
1.2k
Forks
287
Avg merge
1d 17h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vitejs/vite-plugin-react

All issues in vitejs/vite-plugin-react

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.