-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: reactoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Feature Request
- I would like to work on this feature!
Is your feature request related to a problem? Please describe.
When building an app with React, React.forwardRef calls prevent tree shaking unused components. This can be fixed by adding a /*#PURE*/ annotation so terser knows it's safe to remove. I think @babel/preset-react could do this automatically.
Describe the solution you'd like
Either @babel/plugin-transform-react-jsx or a separate plugin could add /*#PURE*/ comments when forwardRef calls are seen.
Describe alternatives you've considered
A separate plugin outside the babel monorepo. But then it would be up to individual apps to adopt that plugin rather than getting this for free just by upgrading babel.
Teachability, Documentation, Adoption, Migration Strategy
Would happen automagically. 😉
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: reactoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue