Re.Pack Cut Expensify's Warm Production Bundling by 82%

Published

At Expensify, every engineer bundled the React Native app several times a day, and CI did it on every build. The team's migration issue put native production JavaScript bundling at 11 seconds when it could reuse cached work, or 88 to 94 seconds with an empty cache.

Web and native also had different build setups to maintain, including two implementations of React Compiler that could handle the same code differently. Moving native from Metro to Re.Pack gave Expensify a way to share more tooling with web while cutting the time spent bundling. In the migration benchmarks, that 11-second warm production bundle came down to 2 seconds, about 82% less time.

Why Re.Pack fit the existing setup

In July 2026, Expensify had moved web builds to Rsbuild, which runs on Rspack, a bundler written in Rust. Re.Pack, our build tool for React Native, also supports Rspack, so the native app could use the same underlying bundler as web.

Native used the Babel React Compiler and web used OXC, whose behavior could differ when compiling the same application code. In the PR review, the team flagged the risk of accidentally using the Babel compiler and missing the resulting differences in CI.

Putting native on Re.Pack would let it use the OXC pipeline already used by web. Engineers could then check compiler behavior across web and native using the same implementation and move toward shared settings.

Web and native share Rspack and the OXC React Compiler; selected dependencies still need Babel.
Web and native share Rspack and the OXC React Compiler; selected dependencies still need Babel.

Getting the app onto the new pipeline

Expensify configured Re.Pack to send application source and most dependencies through OXC and SWC, Rust-based tools that transform the code. Its dependency loaders run in parallel worker pools.

Some dependencies still needed Babel, including packages with Flow types and packages that register native components, so Expensify kept those on a Babel allowlist. Babel removes the Flow types and runs React Native's codegen plugin to generate the view configuration needed to register those components. If a package skips that codegen step, the app can fail at startup; a CI guard checks dependencies against the list when they change.

Testing also exposed a parsing bottleneck: a single prebuilt 0.5 MB JavaScript file took 95 seconds with hermes-parser, compared with 0.1 seconds with @babel/parser. Expensify's parser shim limits hermes-parser to files with an @flow marker and uses @babel/parser for the other files on that processing path.

The team kept Metro available behind an environment variable in the initial PR, so engineers could switch back while moving native bundling over. After HybridApp release bundling also moved to Re.Pack through Rock, the cleanup PR removed the fallback. Babel remained for the packages that needed it, along with Metro-related utilities for mapping error stacks back to source code.

Faster bundles and shared compiler settings

The migration benchmarks were run on the same machine on the same day. Cold runs started with the cache cleared; warm runs reused cached work.

Measurement Metro Re.Pack + OXC Change
Production JavaScript bundle, cold 88 to 94 s 54 s About 1.7x as fast
Production JavaScript bundle, warm 11 s 2 s 5.5x as fast
Dev server startup, cold, single platform 63 s 47 s About 25% less time
Dev server startup, warm 8 s 4 s 50% less time
Minified JavaScript size 38.12 MB 35.73 MB 6.3% smaller
Hermes bytecode size 45.15 MB 46.75 MB 3.5% larger

Each warm production bundle in the benchmark took 9 fewer seconds, and cold bundling fell by 34 to 40 seconds. That reduced the repeated wait the team had described in its migration issue.

The smaller JavaScript output came with a trade-off, though: Hermes bytecode grew by 3.5%. The PR authors suspected duplicated import wrappers and planned further investigation, including startup measurements. These results cover JavaScript bundling; full native builds and application startup need their own measurements.

The migration also addressed the compiler split. Expensify's shared OXC React Compiler configuration supplies settings for native and web builds, the Jest transform, and compiler checks. A change to those settings can be made in one place and checked across platforms. Web and native retain their own build configurations, with Babel handling the code that still needs it.

If your web build already uses Rspack, this is a reason to look at what native could share with it. Measure the bundling time you stand to save, then check which compiler settings you could maintain together and which dependencies need extra processing. Expensify kept Metro available while making that switch; the Re.Pack quick start covers setup, and its linked PRs show the compatibility work involved.

FAQ

More on Expensify’s Move to Re.Pack

Learn what the benchmarks measure, why Expensify made the switch, and where Babel still fits in the build.

How much faster was Re.Pack than Metro for Expensify?

In Expensify's migration benchmarks, warm production JavaScript bundling fell from 11 seconds to 2 seconds, about 82% less time. Cold production bundling took 54 seconds, compared with 88 to 94 seconds under Metro, approximately 1.7 times as fast. The measurements came from the same machine on the same day.

Why did Expensify replace Metro with Re.Pack?

Expensify wanted native to share more tooling with web, which already used Rsbuild on Rspack. Re.Pack brought native onto Rspack and let the team use the OXC React Compiler pipeline across both platforms. Tooling unification was part of the migration's stated motivation.

Does Re.Pack remove the need for Babel?

Babel can still be part of a Re.Pack build. Expensify keeps selected dependencies on a Babel allowlist because they need Flow-type processing or React Native codegen. Other dependencies and application source use its OXC and SWC pipeline.

Does 82% less bundling time mean the app runs faster?

The 82% reduction measures the time to build a warm production JavaScript bundle. It does not measure native compilation or application startup. Expensify's reported benchmark also showed a 3.5% increase in Hermes bytecode size, which the PR authors planned to investigate.

Insights

Learn more about Developer Experience

cover

May 5Article

Codex Ambassador: Q1 Recap Across 5 Cities

A short recap of Codex events in Berlin, Wroclaw, Warsaw, Sopot, and Miami, plus what we learned from each format and where we want to go next.

cover

Feb 5Live Stream

Storybook Explained: From Basics to Advanced Workflows

Core Storybook concepts, stories and args, interaction testing, and how Storybook works in React Native projects.

cover

Jan 29Article

Announcing AI SDK Profiler for React Native

Announcing the AI SDK Profiler plugin for Rozenite DevTools. Capture OpenTelemetry spans from the Vercel AI SDK and inspect AI requests across on-device and cloud providers.

cover

Nov 28Talk

How I Hacked React Native DevTools (And Built a Plugin Framework)

Learn how React Native DevTools work under the hood, and how to inject custom plugins with clean hooks and no forks.

cover

Sep 16Talk

How I Hacked React Native DevTools (And Built a Plugin Framework)

Learn how React Native DevTools work under the hood, and how to inject custom plugins with clean hooks and no forks.

cover

Jul 28Article

Introducing Rozenite: A Plugin Framework for React Native DevTools

Build custom debugging panels inside React Native DevTools with Rozenite: a modular, TypeScript-ready plugin framework with full device-scoped support.

cover

Feb 12Article

How to Easily Create Native Libraries With Nitro and Turbo Modules

Learn how to optimize React Native performance with Turbo and Nitro Modules. Ditch the legacy bridge and master modern native module development.

cover

Dec 4Podcast

Radon IDE: Better Developer Experience for React Native Teams

Find out how Radon IDE can help increase team velocity and rid you of the common React Native app development pain points.

cover

Sep 19Podcast

Exploring Bun: Jarred Sumner on Hyperfast JavaScript Toolkit

Is Bun the future of React Native package management? Join us as we talk with Jarred Sumner, the creator of this lightning-fast JavaScript toolkit.

cover

Sep 11Podcast

Vim: from Zero to Hero

Discover the power of Vim, the legendary text editor, as we explore its origins, standout features, and practical tips to boost your coding efficiency.

cover

May 15Article

Add-Ons for Web Browsers With React

At times you may need to create an add-on to use a web browser more effectively. Find out how to build one with React.

cover

Jan 27Article

Why Is It Worth to Automate Your Dependency Management with `Autolinking`?

When you automate your dependency management, you can fully focus on developing your app. Find out how you can do it with autolinking.

cover

Mar 19Tutorial

The Hard Way vs. The React Native AI SDK Way: Stop Writing Custom Modules for Every Model

Learn how React Native AI uses a unified provider model to switch between cloud and on-device LLMs without rewriting application logic, enabling reliable AI experiences online and offline.

cover

Mar 12Tutorial

Build Smarter Apps: Tool Calling & AI Orchestration Explained

Learn how on-device models in React Native can call tools, interact with external APIs, and return structured outputs you can use directly in application logic.

cover

Mar 5Tutorial

MLC LLM + React Native: On-Device AI Without the Pain

Learn how to run third-party on-device LLMs in React Native using MLC LLM. Choose your models, run them efficiently across platforms, and keep a unified JavaScript API with React Native AI.

cover

Feb 24Tutorial

Intelligent Fallbacks with Apple Intelligence in React Native

Learn how to use Apple’s built-in Foundation Models in React Native apps, reduce memory usage, and enable fast, fully on-device AI with React Native AI Apple.

cover

Feb 10Tutorial

What Is the React Native AI SDK? A Complete Intro & Quickstart

Learn why on-device AI matters for React Native apps, how local LLMs behave offline, and what problems React Native AI is designed to solve from day one.

cover

Jan 29Tutorial

Implementing an Android TurboModule with Kotlin

Learn how to implement a React Native TurboModule on Android, from the TypeScript spec and Codegen to the Kotlin implementation and package registration.

cover

Jan 19Tutorial

Working with Different Threads in Swift TurboModules

Learn how JavaScript, native module, background, and main threads interact in React Native TurboModules, and how to use GCD queues to run async work safely in Swift.

cover

Jan 9Tutorial

How to Add Type-Safe Constants to Swift TurboModules

Learn how to expose typed, immutable constants from a Swift TurboModule using Codegen, and get full end-to-end type safety between native and JavaScript.

cover

Dec 30Tutorial

Adding Event Emitters to Your TurboModule in Swift

Learn how to emit native events from a Swift TurboModule and subscribe to them in JavaScript, including proper memory management and Codegen integration.

Writing a Swift TurboModule in React Native

Dec 22Tutorial

Writing Your First TurboModule in Swift

Learn how to build a fully working TurboModule in Swift, integrate it with Codegen, and bridge it through Objective‑C inside an Expo app.