-
Notifications
You must be signed in to change notification settings - Fork 48.4k
Add sideEffects flag to react-is for tree shaking #27701
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
LGTM. |
FWIW I actually ended up just copy-pasting and inlining the few If this ever gets merged and released I can try switching back. |
Thanks, makes sense! |
Updates React from 2c338b16f to 0cdfef19b. ### React upstream changes - facebook/react#27821 - facebook/react#27820 - facebook/react#27818 - facebook/react#27819 - facebook/react#27817 - facebook/react#27703 - facebook/react#27796 - facebook/react#27811 - facebook/react#27804 - facebook/react#27807 - facebook/react#27805 - facebook/react#27792 - facebook/react#27788 - facebook/react#26852 - facebook/react#27790 - facebook/react#27786 - facebook/react#27785 - facebook/react#27783 - facebook/react#27784 - facebook/react#27769 - facebook/react#27766 - facebook/react#27701 - facebook/react#27732 - facebook/react#27740 - facebook/react#27767 - facebook/react#27768 - facebook/react#27765 - facebook/react#27759 - facebook/react#27579 - facebook/react#27709 - facebook/react#27734 - facebook/react#27739 - facebook/react#27717 - facebook/react#27583 - facebook/react#27713 Closes NEXT-1887
Updates React from 2c338b16f to 0cdfef19b. ### React upstream changes - facebook/react#27821 - facebook/react#27820 - facebook/react#27818 - facebook/react#27819 - facebook/react#27817 - facebook/react#27703 - facebook/react#27796 - facebook/react#27811 - facebook/react#27804 - facebook/react#27807 - facebook/react#27805 - facebook/react#27792 - facebook/react#27788 - facebook/react#26852 - facebook/react#27790 - facebook/react#27786 - facebook/react#27785 - facebook/react#27783 - facebook/react#27784 - facebook/react#27769 - facebook/react#27766 - facebook/react#27701 - facebook/react#27732 - facebook/react#27740 - facebook/react#27767 - facebook/react#27768 - facebook/react#27765 - facebook/react#27759 - facebook/react#27579 - facebook/react#27709 - facebook/react#27734 - facebook/react#27739 - facebook/react#27717 - facebook/react#27583 - facebook/react#27713 Closes NEXT-1887
## Summary This PR: - Adds the `"sideEffects": false` flag to the `react-is` package, to enable proper tree-shaking ## How did you test this change? React-Redux v9 beta switches its artifacts from separate JS files to pre-bundled artifacts. While testing builds locally, I noticed that our use of `react-is` was no longer getting tree-shaken from Vite builds, despite `react-is` only being used by our `connect` API and `connect` itself getting shaken out of the final bundle. Hand-adding `"sideEffects": false` to the `react-is` package locally convinced Vite (+Rollup) to properly tree-shake `react-is` out of the bundle when it wasn't being used. I'd love to see this published as v18.2.1 as soon as this PR is merged - we're hoping to release React-Redux v9 in the next few weeks!
## Summary This PR: - Adds the `"sideEffects": false` flag to the `react-is` package, to enable proper tree-shaking ## How did you test this change? React-Redux v9 beta switches its artifacts from separate JS files to pre-bundled artifacts. While testing builds locally, I noticed that our use of `react-is` was no longer getting tree-shaken from Vite builds, despite `react-is` only being used by our `connect` API and `connect` itself getting shaken out of the final bundle. Hand-adding `"sideEffects": false` to the `react-is` package locally convinced Vite (+Rollup) to properly tree-shake `react-is` out of the bundle when it wasn't being used. I'd love to see this published as v18.2.1 as soon as this PR is merged - we're hoping to release React-Redux v9 in the next few weeks! DiffTrain build for commit 108fd8c.
Summary
This PR:
"sideEffects": false
flag to thereact-is
package, to enable proper tree-shakingHow did you test this change?
React-Redux v9 beta switches its artifacts from separate JS files to pre-bundled artifacts. While testing builds locally, I noticed that our use of
react-is
was no longer getting tree-shaken from Vite builds, despitereact-is
only being used by ourconnect
API andconnect
itself getting shaken out of the final bundle.Hand-adding
"sideEffects": false
to thereact-is
package locally convinced Vite (+Rollup) to properly tree-shakereact-is
out of the bundle when it wasn't being used.I'd love to see this published as v18.2.1 as soon as this PR is merged - we're hoping to release React-Redux v9 in the next few weeks!