DS-667 Individual icon JS imports #2369
Merged
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.
Jira
https://pegadigitalit.atlassian.net/browse/DS-667
Summary
Import JS icons individually to avoid shipping unused code.
Details
Until we upgrade to Webpack 5, we can't tree shake unused icons. So, we must do this ourselves by importing only what we need. This PR updates the icon build step to output individual files for each icon and updating the components to import them directly.
How to test
./www/build
folder for a clean startyarn start
./www/build
folder:M25.8 20.5c-3 3.2-6.3
(a string from the "eye" icon, which isn't included anywhere). Verify there are no results.M26.6 12.4c.6-.6.6-1.6
(a string from "chevron-down" icon, which is included in the accordion component). Verify it is there in the build folder.