Skip to content

[Due for payment 2026-03-19] [$250] Enable Platform Shaking for React Native Bundle Size Optimization #80500

@roryabraham

Description

@roryabraham

Proposal

Enable Platform Shaking for React Native Bundle Size Optimization

Problem

The app’s Hermes Bytecode (HBC) bundle is larger than necessary. The Metro bundler and Babel transformer are using default configurations that do not enable Metro’s import support, which prevents Metro from performing platform-specific code elimination.
Additionally, the app includes expo/metro-config in metro.config.js, which is unnecessary since we do not use the Expo CLI. A larger bundle size leads to slower app startup times and higher memory consumption.

Solution

Enable platform shaking by aligning Metro and Babel configurations and removing the unnecessary Expo Metro config dependency. This allows Metro to exclude unused, platform-specific code from the final bundle.

Results

With these changes, we reduced the bundle size from 37.1 MB to 34.2 MB (~2.9 MB reduction, approximately 8%).
We still need to test this on ad-hoc builds to confirm all works correctly

Draft PR -> https://github.com/Expensify/App/pull/80110/files
Inspiration -> https://x.com/thymikee/status/2013321153700340183

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022024957569917353966
  • Upwork Job ID: 2024957569917353966
  • Last Price Increase: 2026-02-20

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.Melvin TriageAutomatic AI Analysis of an issueMonthlyKSv2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions