Skip to content

chore(www): remove react-icons dependency#140

Merged
guidefari merged 1 commit into
prodfrom
chore/remove-react-icons
Jul 10, 2026
Merged

chore(www): remove react-icons dependency#140
guidefari merged 1 commit into
prodfrom
chore/remove-react-icons

Conversation

@guidefari

Copy link
Copy Markdown
Owner

Summary

Follow-up to #139. That PR swapped the 5 react-icons imports that sat on the homepage's critical path over to lucide-react / inline SVG. The only usage left afterward was 11 Simple Icons brand marks (Spotify, YouTube, Apple Music, Bandcamp, SoundCloud, Tidal, Discord, Instagram, X, MusicBrainz, YouTube Music) in the admin playlist track editor's platform badges — already isolated into its own chunk by auto code-splitting, so zero homepage impact either way. Removing it anyway since there's no reason to keep a whole dependency around for one file.

Why react-icons specifically (context for future reference)

While investigating the homepage bundle in #139, react-icons looked tree-shakeable on paper — sideEffects: false, plain named ESM function exports, no barrel indirection. In practice, under this project's bundler (rolldown), swapping 5 of the 6 usages barely moved the gzip size of the entry chunk until the dependency was fully gone from that code path. Don't assume react-icons subpath imports tree-shake cleanly here; treat any import from it as "the whole icon set ships."

What changed

  • New apps/www/src/components/icons/BrandIcons.tsx: 11 local inline SVG components, one per platform, sharing a small BrandIcon(path) factory.
  • -SortableTrackRow.tsx: swapped react-icons/si imports for the new components; dropped IconType (from react-icons) for a local ComponentType<SVGProps<SVGSVGElement>> type.
  • react-icons removed from apps/www/package.json, lockfile updated.

Correctness check

These are hand-copied brand marks, so eyeballing isn't enough — wrote a one-off script to diff the d path attribute of each new component against the exact source in the installed react-icons/si/index.mjs module. All 11 matched byte-for-byte. (Script was scratch tooling, not committed.)

Measurements

  • -PlaylistsTab chunk (which bundles this route): 35.4 KB → 32 KB gzip (~10%)
  • Homepage entry chunk: unchanged (this route was already split out by auto code-splitting from perf(www): cut homepage entry bundle 45%, LCP 1.8s -> 1.0s #139, so it was never in the critical path)
  • One fewer dependency in apps/www/package.json

Test plan

  • bun run typecheck passes across all packages
  • bun run precommit (format + lint + typecheck, repo-wide) passes clean
  • Programmatic path-data diff confirms all 11 icons are pixel-identical to the react-icons originals
  • bun run build succeeds, confirmed chunk size delta

Last remaining usage was 11 Simple Icons brand marks (Spotify,
YouTube, Apple Music, etc.) in the admin playlist track editor's
platform badges. Empirically, react-icons subpath imports don't
tree-shake cleanly under this project's bundler (confirmed while
investigating homepage bundle size in #139 - swapping 5 icons used
elsewhere barely moved the gzip size until the whole dependency was
gone from that code path).

This route is already isolated into its own chunk by TanStack
Router's auto code-splitting, so it had zero homepage impact, but
there's no reason to keep the dependency around for one file.

Replaced with local inline SVG components in a new BrandIcons.tsx,
using the exact same path data as the react-icons source (diffed
programmatically against the installed package to confirm byte-for-
byte parity, since these are hand-copied brand marks). -PlaylistsTab
chunk (which contains this route) drops from 35.4KB to 32KB gzip.
@guidefari guidefari merged commit 1c82089 into prod Jul 10, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.65.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant