Skip to content

rolldown-vite 7.1.0 and plugin-react 5.0.0 error with Class components when using react-compiler #368

@dan-proudfoot-bots

Description

@dan-proudfoot-bots

Describe the bug

Posted this on the discord but told to move it out to here.

Trying to migrate a fairly big work project over to rolldown-vite and am getting errors with plugin-react v5. I didn't have this problem in v4 so I assume it's something to do with adding OXC into the plugin

You may have to download the project from Stackblitz and run locally as the WASM version doesn't seem very happy.

When ran locally, the server boots, but if you open the page you'll see that there's a console error

Uncaught SyntaxError: Identifier 'RefreshRuntime' has already been declared

This has replaced a previous error that mentioned oxc compilation issues, that I cannot replicate now.

I have been highlighted that there might also be a related issue in the plugin-react repo vitejs/vite-plugin-react#346

Reproduction

https://stackblitz.com/edit/vitejs-vite-qifa3tcf?file=src%2Fmain.tsx

Steps to reproduce

I have found that this only occurs when using react-compiler. Removing it from the babel plugins fixes the issue.

System Info

System:
    OS: macOS 15.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 1.43 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.19.0 - ~/.volta/tools/image/node/20.19.0/bin/node
    Yarn: 3.2.4 - ~/Dev/Bots/portal/node_modules/.bin/yarn
    npm: 10.8.2 - ~/.volta/tools/image/node/20.19.0/bin/npm
    bun: 1.2.8 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 138.1.80.124
    Edge: 139.0.3405.86
    Safari: 18.5
  npmPackages:
    @vitejs/plugin-react: 5.0.0 => 5.0.0 
    rolldown-vite:  7.1.1

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions