Fix React Aria Components tree shaking#4357
Merged
Merged
Conversation
snowystinger
previously approved these changes
Apr 10, 2023
Member
snowystinger
left a comment
There was a problem hiding this comment.
just to make sure, this comment doesn't get removed by anything? I assume that minifiers are smart enough to not remove it and swc won't remove ones it didn't add?
Member
Author
|
I ran the build and the comment was preserved. |
|
Build successful! 🎉 |
|
## API Changes
unknown top level export { type: 'identifier', name: 'Column' } |
snowystinger
approved these changes
Apr 10, 2023
reidbarber
approved these changes
Apr 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4356
Normally SWC inserts a PURE annotation comment on React
forwardRefcalls so that they can be tree-shaken when unused. But in the cases where we use a TypeScript cast this doesn't work, so all of those components end up getting included in application bundles even when not used. This PR adds the PURE annotation comments manually in those cases. A follow up could be to make SWC smarter about this.