Skip to content

Trim Reanimated and unused icon families from the web bundle - #574

Merged
karanshukla merged 1 commit into
mainfrom
perf/trim-web-bundle
Nov 26, 2026
Merged

karanshukla merged 1 commit into
mainfrom
perf/trim-web-bundle

Conversation

@karanshukla

Copy link
Copy Markdown
Owner

Summary

Cuts the guest web pages from 1.68 MB to 867 KB transferred and TBT by about a third. Two causes:

  • app/_layout.tsx imported react-native-reanimated on every platform, which put ~650 KB of it in the web __common chunk. The website never needs it at the root (the admin swipe row imports it itself). The import now lives in utils/loadReanimated.native.ts.
  • Icon and LoadingScreen imported from the @expo/vector-icons barrel, which bundles every family's glyph map. Icon now imports Ionicons by path. LoadingScreen draws its icon through Icon (Ionicons restaurant) instead of the one MaterialCommunityIcons glyph, so the 549 KB MCI font is no longer downloaded.

jest.setup.ts forwards @expo/vector-icons/Ionicons to the barrel mock, so the existing per-file barrel mocks (89 files) keep applying without touching them.

Related issue

None.

Scope

  • API (OpenRestoApi)
  • Frontend (openresto-frontend)
  • Database migration
  • Docs / infra

Changes

Local Lighthouse 13.6.0, mobile preset, expo export served with serve -s dist, median of 3:

Home before Home after /locations before /locations after
Score 32 41 44 52
TBT 1.8 s 1.29 s 1.87 s 1.22 s
LCP 9.9 s 6.5 s 11.4 s 6.4 s
Transferred 1.68 MB 866 KB 1.68 MB 867 KB
JS (gzip) 889 KB 626 KB 891 KB 628 KB

__common goes from 2.3 MB to 1.2 MB raw. The loading screen icon changes from MCI silverware-fork-knife to Ionicons restaurant.

Testing

  • OpenRestoApi.Tests pass locally (no API changes)
  • Frontend tests/build pass locally: npm run check, tsc --noEmit, npm test (311 suites), npm run test:android (162 suites), expo export --platform web
  • CI passes (build, migration-check)
  • Manually verified the change end-to-end: loading screen and /admin/notifications (swipe rows) render on web with no console errors. Native not run here; it keeps the same import through the .native file.

Migrations

  • This PR includes a database migration
  • Migration was tested locally (up and, if applicable, down)

Checklist

  • No secrets, connection strings, or credentials committed
  • Docs updated if API contracts or setup changed

The root layout imported react-native-reanimated on every platform, which put
~650 KB of it in the web __common chunk although the website never needs it at
the root. Move the import to a .native file.

Icon and LoadingScreen imported from the @expo/vector-icons barrel, which bundles
every family's glyph map. Import Ionicons by path and draw the loading icon with
it, so the 549 KB MaterialCommunityIcons font is no longer downloaded.
@karanshukla
karanshukla merged commit 68aa5c0 into main Nov 26, 2026
24 checks passed
@karanshukla
karanshukla deleted the perf/trim-web-bundle branch November 26, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant