Skip to content

[DX] Replace Metro bundler with Re.Pack #58311

Closed as not planned
Closed as not planned

Description

@roryabraham

HOLD for callstack/repack#1153

Coming from https://expensify.slack.com/archives/C05LX9D6E07/p1741797410875869

Proposal: Improve JS bundle size and build times

Background

JavaScript bundlers play a critical role in the React Native ecosystem by transforming modern JavaScript code into optimized packages that can run efficiently on mobile devices. Over time, various bundling tools have emerged with different performance characteristics and feature sets to address the complex requirements of mobile application development. Currently, we use Metro bundler, the default tool for React Native projects.

Problem

When engineers need to start a new development session with npm run ios/android, the application's JS part is built in 30-40 seconds (cold) and 6 seconds (warm). These delays, while seemingly small, compound throughout the day and impact development velocity.

Solution

Use Re.Pack for JS bundling instead of Metro to leverage its out-of-the-box performance advantages and Webpack-based architecture.

JS build time before/after

npm run ios/android no cache: ~30-40s → ~8s (73-80% reduction)
npm run ios/android with cache: 6s → 1s (83% reduction)

Bundle size before/after

Production bundle size: 15.54MB → 13.36MB (14.03% reduction)
Hermes bytecode size: 21.62MB → 19.05MB (11.89% reduction)

Activity

  1. self-assigned this
    on Mar 12, 2025
  2. changed the title [-]Replace Metro bundle with Re.Pack[/-] [+][DX] Replace Metro bundler with Re.Pack[/+] on Mar 12, 2025
  3. zirgulis commented on Mar 12, 2025

    @zirgulis
    Contributor

    Hi I'm Povilas from Callstack and I would like to work on this issue.

  4. adhorodyski commented on Mar 13, 2025

    @adhorodyski
    Contributor

    I'll coordinate this with Povi, but just as a heads up this will have to be timed nicely with the introduction of RNEF for remote builds, which is happening early next week. We probably don't want to get both the tools into main at the same time and touch all the builds steps - my recommendation would be to await merging Repack just a little bit.

  5. roryabraham commented on Mar 19, 2025

    @roryabraham
    ContributorAuthor

    ok, let's just put this on HOLD until #58743 is done. feel free to work on testing it out locally with rnef in the meantime though @zirgulis

  6. changed the title [-][DX] Replace Metro bundler with Re.Pack[/-] [+][HOLD #58743][DX] Replace Metro bundler with Re.Pack[/+] on Mar 19, 2025
  7. adhorodyski commented on Mar 19, 2025

    @adhorodyski
    Contributor

    👍🏼 We agreed with @zirgulis will keep on rebasing these updates on a separate branch & testing with the Repack plugin for RNEF.

  8. zirgulis commented on Mar 19, 2025

    @zirgulis
    Contributor

    yes I'm currently testing the RNEF CLI locally together with repack 👍🏼

  9. parasharrajat commented on Mar 30, 2025

    @parasharrajat
    Member

    I can help review this as well given that I am reviewing #58743

  10. roryabraham commented on Apr 1, 2025

    @roryabraham
    ContributorAuthor

    Great, bringing on @parasharrajat as C+ here. Thanks for volunteering @parasharrajat!

  11. 41 remaining items

  12. roryabraham commented on Aug 25, 2025

    @roryabraham
    ContributorAuthor

    @mountiny For context, this originated in a slack proposal here.

  13. changed the title [-][HOLD][DX] Replace Metro bundler with Re.Pack[/-] [+][DX] Replace Metro bundler with Re.Pack[/+] on Aug 25, 2025
  14. mountiny commented on Aug 29, 2025

    @mountiny
    Contributor
  15. roryabraham commented on Sep 3, 2025

    @roryabraham
    ContributorAuthor

    updated proposal and discussion here

  16. roryabraham commented on Sep 12, 2025

    @roryabraham
    ContributorAuthor

    I'm not sure where we stand with this one. I don't think we really have consensus to adopt Re.Pack, and its marginal bundle size reduction and productivity improvements aren't the most pressing problems to solve, so I'm going to just close this for now for #focus.

    I believe we're open to the idea of adopting Re.Pack, but only as a solution to a serious problem, and ideally a customer-facing problem at that. It seems like the ROI of a bundle size 10% JS bundle size reduction would be really low for now. Maybe down the line as a way to load larger JS bundles (such as translations or on-device LLMs) OTA, Re.Pack would be a way to provide functionality that Metro can't.

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

Metadata

Metadata

Labels

ImprovementItem broken or needs improvement.WeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions