Repository navigation
perf(mobile): drop 87 unused harmony icon exports from the bundle - #14713
Merged
Merged
Conversation
Metro doesn't tree-shake, so every icon re-exported from harmony-native/icons.tsx ships in the JS bundle whether or not mobile renders it. 87 of the 234 exports (file-type icons, extra CC license icons, both color horizontal Audius logos, Metamask, Soundwave, etc.) have no references in packages/mobile. iOS release bundle: 13.27 MB -> 12.91 MB (-362 KB), gzip -88 KB. Harmony icon bytes: 700 KB -> 369 KB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Metro doesn't tree-shake, so every icon re-exported from
packages/mobile/src/harmony-native/icons.tsx(pulled in byexport * from './icons'inharmony-native/index.ts) ships in the JS bundle whether mobile renders it or not.I grepped
packages/mobile/srcandpackages/mobile/examplesfor each exported name. 87 of the 234 exports are never referenced, and nothing looks icons up dynamically (noicons[name]or template-string lookups). This PR deletes those 87 export lines. The removed exports are:IconFile*type iconsIconCcNC_EU,IconCcPD,IconCcRemix,IconCcSampling*, …)IconAudiusLogoHorizontalColorandIconAudiusLogoHorizontalColorNew: 61 KB of source, with embedded base64IconAudiusLogoVertical,IconMetamask,IconFacebook,IconTelegram,IconLogoCircleUSD/USDC/STR,IconCoinGatedLabel, theSoundwaveanimation,IconPlaybackRate0_9x(not aPlaybackRatevalue), and assorted othersHarmony itself is unchanged. Web still gets every icon.
Numbers (iOS,
react-native bundle --dev false --minify true)harmony/src/assets/icons(source-map-explorer)The icons left in the bundle are all small: the largest is
JupiterLogo.svgat 6.5 KB. Running svgo on them wouldn't save much, so this PR doesn't.Test plan
tscinpackages/mobilepasses. Any import of a removed name would fail it.icons.tsx🤖 Generated with Claude Code