-
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
feat: reduce icon file size #3283
Conversation
Thanks for the pull request, @bradenmacdonald! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
✅ Deploy Preview for paragon-openedx ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3283 +/- ##
=======================================
Coverage 93.31% 93.31%
=======================================
Files 249 249
Lines 4441 4441
Branches 1014 1014
=======================================
Hits 4144 4144
Misses 294 294
Partials 3 3 ☔ View full report in Codecov by Sentry. |
Closing for now in favor of #3284 which has incorporated these same changes. |
Description
Currently, the transpiled
.js
file of each of our icons contains some boilerplate to support extremely old browsers that don't understand the...spread
operator:This code is not necessary at all, yet it is included in every single icon file, and will be incorporated many times over into the final build. This doesn't actually impact bundle size much in practice because so much redundancy gets heavily compressed by gzip before being sent over the wire. But it's still adding complexity to these files that isn't needed, so I'd like to remove it.
In addition to removing the
extends()
operator, this PR turns on Babel preset-env's"targets": "defaults"
option, which enables other syntax modernization:const
instead ofvar
and a fat arrow function instead of afunction
(which also makes the overall file more compact). These changes are not as important to me but they also clean things up, at the slight cost of changing the indentation of every line in the file.Before: 3,102,133 bytes for 2,320 items
After: 2,179,463 bytes for 2,320 items
The change to the babel config is isolated in commit dbdf7b8 - the rest is just from running
npm run build
after making that change. Only the .js files are affected - no changes to .svg nor .jsx.See also #3284 which makes a similar change for Paragon overall.
Deploy Preview
https://deploy-preview-3283--paragon-openedx.netlify.app/foundations/icons/
No change should be discernable.
Merge Checklist
example
app?Post-merge Checklist