-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix: make icons package tree-shakeable #2441
Conversation
Thanks for the pull request, @viktorrusakov! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
✅ Deploy Preview for paragon-openedx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This solution definitely helps with the resulting bundle's raw "stat" size; I believe it's still an open question on why the parsed/gzipped size doesn't seem to be changing for a test case that uses the Without With I'd recommend we still merge/release this |
@adamstankiewicz I'm pretty sure parsed and gzipped sizes don't change because webpack itself detects that most of the icons are not used and removes them during the minimization process. I've tested this with our Removing terser plugin (i.e. Sooo I'm 99,9999% sure that currently even though all of the icons are present in the initial bundle of the MFEs that use Paragon, they are removed in the final bundle and don't cause bundle size / performance issues. I also validated it manually with our I guess this PR only ensures that icons don't get into they initial bundle, even though they would get removed by terser plugin anyway. Still this adds additional guarantee that we don't include all of the icons in the bundle 🙂. |
@viktorrusakov 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
🎉 This PR is included in version 20.45.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@viktorrusakov Thanks for doing a deeper dive in the bundle assets! Interesting find. So, it seems the output shown by Webpack Bundle Analyzer (i.e., |
Description
Currently, all of the Paragon icons are included into the bundle if at least one icon is used in the project. This PR adds tree-shaking support to include only used icons into the bundle.
Previously, using
SearchField
component (that uses couple of icons internally) would result in following Paragon bundle, which included all of the iconsthis PR reduced the bundle to this
Deploy Preview
Include a direct link to your changes in this PR's deploy preview here (e.g., a specific component page).
Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist