Skip to content

[Due for payment 2026-07-23] Replace Webpack + Babel with Rsbuild + OXC for E/App #95833

Description

@roryabraham

Original proposal: Slack thread

Proposal: Replace Webpack + Babel with Rsbuild + OXC for E/App.

Strategy: Engineering velocity — how fast an engineer can make a change and see it reflected, and how fast CI/CD can turn a PR into mergeable, deployed artifact — impacts how many product improvements we can ship per engineer-hour, which impacts our ability to out-iterate the competition.

Background: New Expensify's web client (App) is built with Webpack 5, configured in config/webpack/. Webpack has been the web bundler since the project's inception: it handles three "production" build variants (production, staging, ad-hoc) and a local dev server (webpack-dev-server). CI additionally triggers a full production build on every relevant PR and deploy.

Storybook, our component-docs site, also builds via its own separate Webpack config.

In 2023, engineers observed webpack-dev-server memory usage growing unboundedly over long-running sessions, and worked around it with start-dev-with-auto-restart.sh (monitors process memory, force-restarts the dev server past a threshold) plus a custom ForceGarbageCollectionPlugin that periodically forces garbage collection. Both are still part of the local web dev setup today.

Every TS/TSX file also runs through babel-loader as part of that Webpack pipeline: React Compiler compilation (babel-plugin-react-compiler), TS/TSX/Flow syntax transforms (@babel/preset-react, @babel/preset-env, @babel/preset-typescript, @babel/preset-flow), and RN-Web mapping (babel-plugin-react-native-web). Babel is a mature, pure-JS, AST-walking toolchain — each file makes several passes through several plugins before it's Webpack-ready.

Current build times:

  • Production/Staging/AdHoc/Dev, cold: ≈301.5s
  • Dev, warm: ≈8.65s
  • Storybook, cold: ≈117.6s
  • Storybook dev, cold: ≈96s
  • Storybook dev, warm: ≈7.8s

Problem: When engineers iterate locally, run AdHoc builds, or CI validates a merge to main, if a web build takes ≈5 mins to run cold, then engineering velocity is slowed, which prevents us from delivering new code as fast as possible.

To ground this at our scale:

  • CI: testBuildOnPush triggers one AdHoc web build for every PR merged into main. 6,283 PRs were merged into Expensify/App in the last 6 months alone — ≈526 hours (≈22 days) of build time in that window.
  • Local + agent builds: a conservative guess of ≈25 cold web builds/dev-server boots per day across all engineers and AI coding agents combined (background agents and MelvinBot automation are especially prone to this, since every new git worktree they spin up starts from a fresh, unprimed cache). 25 builds/day × ≈5 min/build ≈ 125 min/day, or ≈381 hours (≈16 days) over the same 6-month window.

Solution:
Swap two pieces of the build pipeline for modern Rust-based equivalents:

  1. Webpack → Rsbuild (built on Rspack). Rspack is a bundler built in Rust that targets close compatibility with Webpack's config/plugin/loader API, making it a relatively low-risk swap. Our existing configs mostly port over, with custom plugins swapping imports from webpack to @rspack/core. We can drop the auto-restart wrapper and forced-GC plugins from 2023, since they aren't necessary with Rsbuild's dev server.
  2. Babel → OXC. OXC is a Rust-based JS toolchain, including a transformer (like Babel).
    • bonus: Because OXC is built in Rust, we can leverage the Rust port of React Compiler, giving a ~10x speedup to what is by far the slowest babel transform today
    • caveat: Babel can't yet be fully removed, but shrinks to a single narrow job: the react-native-worklets/plugin pass (Reanimated worklets need Babel's plugin system specifically).

Apply both to the app's production/staging/ad-hoc build, Storybook, and the dev server.

Benchmarks:

  • Production, cold: ≈18.4s, ~16.4x faster
  • Dev, cold: ≈10.9s, ~27.7x faster
  • Dev, warm (HMR rebuild): ≈0.15–0.17s, ~57.7x faster
  • Storybook: ≈25.7s, ~4.6x faster
  • Storybook dev, cold: ≈14s, ~6.9x faster
  • Storybook dev, warm: ≈0.19s, ~41x faster

Note: Switching from Babel → OXC for most transforms will improve not only web builds, but the JS portion of iOS/Android builds as well.

Issue OwnerCurrent Issue Owner: @roryabraham

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions