-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce web bundle size #5203
Reduce web bundle size #5203
Conversation
Sounds like something worth doing. For now, we could support it via some environment variable, e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the approach is correct but there are still some little things to be addressed prior to merging. I've left a few suggestions, but let's write them down and apply them in separate PRs. Let's keep the scope of this PR as web-oriented as possible and we can improve other things later.
…omiejbloniarz/reduce-bundle-size-web-2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! 👏
Summary
This PR moves some web implementations to
.web.ts
files, so that native implementations are excluded from the bundle. Some changes here might be controversial (e.g.SharedTransition.web.ts
), since they introduce some level of code duplication. These changes, however, allow webpack to better recognize which code should be excluded from the bundle.While working on this issue I also found some other areas that can be changed in the future to further optimize the bundle size:
Test plan
Run
yarn build
inNextExample
. The difference betweenreanimated.js
andnoreanimated.js
should be around 43kB.