vitejs / vite-plugin-react

The all-in-one Vite plugin for React projects.
MIT License
546 stars 102 forks source link

Running React Compiler not successful #322

Closed williamlsh closed 1 month ago

williamlsh commented 1 month ago

Describe the bug

Running React Compiler according to official guide on an existing React + Vitejs project not successful.

Running react-compiler-healthcheck@latest already pass.

babel-plugin-react-compiler already installed.

vite-plugin-react plugin already installed.

Reproduction

https://stackblitz.com/edit/vitejs-vite-33dfp4?file=vite.config.ts

Steps to reproduce

npm run dev

System Info

Linux

Used Package Manager

npm

Logs

[plugin:vite:import-analysis] Missing "./compiler-runtime" specifier in "react" package

Validations

sapphi-red commented 1 month ago

You need to run npm install -D babel-plugin-react-compiler. Also you need to upgrade react to v19 beta. https://react.dev/learn/react-compiler#:~:text=React%20Compiler%20requires%20React%2019%20Beta.

williamlsh commented 1 month ago

Indeed, it works after upgrading to React 19 beta.