You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
React Compiler skips components with default destructured props when using @vitejs/plugin-react #1458
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.
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.
After investigation, the root cause is in babel-plugin-react-compiler
itself, not in @vitejs/plugin-react.
The compiler silently bails out on components with default destructured
props when running under @babel/core@8, because Babel 8 removed
AssignmentPattern from the LVal alias.
Activity
hazhirmohammadi commentedon Sep 19, 2026
After investigation, the root cause is in babel-plugin-react-compiler
itself, not in @vitejs/plugin-react.
The compiler silently bails out on components with default destructured
props when running under @babel/core@8, because Babel 8 removed
AssignmentPattern from the LVal alias.
This is already tracked and being fixed in react/react#36956.
Thank you for your response!