Related plugins
Describe the bug
When using React Compiler with @vitejs/plugin-react, components with destructured props that have default values, such as variant = 'primary', may be skipped by the compiler and not optimized as expected.
However, the same component works as expected in a Vite project using @vitejs/plugin-react. This issue was initially observed in a project created with the tsdown React Compiler template.
Reproduction
https://github.com/hazhirmohammadi/tsdown-react-compiler
Steps to reproduce
- Clone the reproduction repository.
- Install the dependencies:
npm install
- Build the project:
npm run build
- Inspect the generated output.
- Compare the compiled output of
Button and Button2.
- Observe that
Button is skipped by React Compiler when using the default destructured prop variant = 'primary', while Button2 without the default value is compiled/optimized.
The issue was initially observed in tsdown. Following the recommendation from the tsdown maintainers in the original issue, I tested the same case with Vite and @vitejs/plugin-react to determine whether the issue could be related to the React plugin.
The issue could not be reproduced in the Vite setup.
System Info
System:
OS: Linux 6.17 Ubuntu 25.10 25.10 (Questing Quokka)
CPU: (16) x64 Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
Memory: 5.08 GB / 14.90 GB
Container: Yes
Shell: 5.2.37 - /bin/bash
Binaries:
Node: 24.20.0 - /home/hazhir/.local/share/pnpm/bin/node
npm: 11.6.2 - /home/hazhir/.nvm/versions/node/v24.20.0/bin/npm
pnpm: 11.25.0 - /home/hazhir/.local/share/pnpm/bin/pnpm
Browsers:
Chrome: 153.0.8010.36
Firefox: 155.0.1
Firefox Developer Edition: 155.0.1
npmPackages:
@vitejs/plugin-react: ^6.0.3 => 6.1.1
vite: ^8.1.4 => 8.3.0
Used Package Manager
npm
Logs
No response
Validations
Related plugins
plugin-react
plugin-react-swc
plugin-rsc
Describe the bug
When using React Compiler with @vitejs/plugin-react, components with destructured props that have default values, such as variant = 'primary', may be skipped by the compiler and not optimized as expected.
However, the same component works as expected in a Vite project using @vitejs/plugin-react. This issue was initially observed in a project created with the tsdown React Compiler template.
Reproduction
https://github.com/hazhirmohammadi/tsdown-react-compiler
Steps to reproduce
npm install
npm run build
ButtonandButton2.Buttonis skipped by React Compiler when using the default destructured propvariant = 'primary', whileButton2without the default value is compiled/optimized.The issue was initially observed in tsdown. Following the recommendation from the tsdown maintainers in the original issue, I tested the same case with Vite and
@vitejs/plugin-reactto determine whether the issue could be related to the React plugin.The issue could not be reproduced in the Vite setup.
System Info
System: OS: Linux 6.17 Ubuntu 25.10 25.10 (Questing Quokka) CPU: (16) x64 Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz Memory: 5.08 GB / 14.90 GB Container: Yes Shell: 5.2.37 - /bin/bash Binaries: Node: 24.20.0 - /home/hazhir/.local/share/pnpm/bin/node npm: 11.6.2 - /home/hazhir/.nvm/versions/node/v24.20.0/bin/npm pnpm: 11.25.0 - /home/hazhir/.local/share/pnpm/bin/pnpm Browsers: Chrome: 153.0.8010.36 Firefox: 155.0.1 Firefox Developer Edition: 155.0.1 npmPackages: @vitejs/plugin-react: ^6.0.3 => 6.1.1 vite: ^8.1.4 => 8.3.0Used Package Manager
npm
Logs
No response
Validations