Repository navigation
Bundle native builds with Re.Pack + OXC transform pipeline - #99407
roryabraham merged 51 commits into
Conversation
# Conflicts: # ios/Podfile.lock
# Conflicts: # ios/Podfile.lock # package-lock.json
# Conflicts: # ios/Podfile.lock
hermes-parser takes ~95s to parse this minified single-line browser bundle, serializing the whole cold build. It is plain ESM with no RN-specific syntax, so rspack parses it natively. Cold prod bundle drops from ~120s to ~48s; dev server cold start from 146s to 78s.
Split the node_modules rule in two: packages that genuinely need babel + hermes-parser (Flow-typed RN core, codegenNativeComponent libs, Re.Pack's own runtime) stay on babel-swc-loader; everything else goes through the same OXC chain as app source (oxc -> worklets -> CJS lowering), with parallel workers and Fast Refresh disabled for third-party code. The cjs-inline-requires loader gains two options: sourcemap (prebuilt bundles ship multi-source maps that remapping() rejects) and hermesLowering (Hermes cannot parse async generators). Same-day numbers vs Metro: prod cold 85s -> 50s, dev cold (--platform ios) 54s -> 53s, dev warm 8s -> 4s, minified JS -3.5%. Boot-verified on iOS standalone, Android emulator, and HybridApp simulator builds.
…ie-hermes-parse # Conflicts: # ios/Podfile.lock # tsconfig.json
commented
Aug 25, 2026
|
|
| * Flow) and packages calling `codegenNativeComponent` in shipped JS, which needs the RN preset's | ||
| * codegen plugin to register Fabric view configs — without it the app crashes on boot. | ||
| */ | ||
| const BABEL_PACKAGES = [ |
There was a problem hiding this comment.
This is why the CI script in the post merge pr is crucial - because when there will be deps or new packages that meet those conditions in the comment and won't added to this allowlist if will crush on boot
There was a problem hiding this comment.
@elirangoshen Can you please restore --verbose flag here?
|
@elirangoshen Please resolve conflicts so that I can test on xcode 27 |
…ie-hermes-parse # Conflicts: # ios/Podfile.lock
Keeps build logs verbose as before; this PR should not change run-build.sh.
commented
Sep 18, 2026
done |
commented
Sep 18, 2026
Screen.Recording.2026-09-18.at.3.46.58.PM.mov@elirangoshen App crashes on launch |
commented
Sep 18, 2026
ok following our discussion I'm investigating it. |
commented
Sep 18, 2026
|
So app is crashing on main too with the same stack trace you sent tome. so issue doesn't seems to be in the pr but in app with xcode 27 and latest main. maybe we can test it with xcode 26 until main will be fix ? @shubham1206agra |
commented
Sep 20, 2026
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-09-18.at.10.25.07.PM.movScreen.Recording.2026-09-18.at.10.27.35.PM.movScreen.Recording.2026-09-20.at.6.25.19.PM.mov |
left a comment
There was a problem hiding this comment.
@MelvinBot create a follow-up issues to remove Metro and consolidate on a single Rust-based React Compiler. Simplify surrounding tooling / CI checks. Note that this locks us into Re.Pack, but greatly simplifies repo configs and saves time in CI (including lint).
There was a problem hiding this comment.
by convention, ID should be capitalized:
sentryDebugIDPlugin
There was a problem hiding this comment.
Did you look at how much we could potentially DRY between the web/rsbuild config and the repack rspack config
commented
Sep 20, 2026
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
commented
Sep 20, 2026
|
Created two follow-ups. I split them because they have different blockers — the compiler consolidation can start now, Metro removal can't.
Both note the Re.Pack lock-in explicitly. Both are assigned to One sequencing call I left to whoever picks these up: |
commented
Sep 20, 2026
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
commented
Sep 20, 2026
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
commented
Sep 21, 2026
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.91-0 🚀
|
commented
Sep 21, 2026
|
🤖 No help site changes are required for this PR. I did not create a docs PR. This is a build-tooling change only. It swaps the native JS bundler from Metro to Re.Pack + OXC and changes how How I checkedThe diff has no user-facing surface. Of the 25 changed files, 24 are build config, patches, or lockfiles ( The single in No feature, label, or flow changed. The help site documents product behavior — workspace settings, expense flows, integrations, billing. This PR touches none of them. There are no new or renamed settings, tabs, buttons, or menu items to document, and no changed steps for any existing article. No article references bundling. I searched The performance gains are developer-only. The faster cold and warm bundle times in the PR description describe local and CI build speed, not app startup or runtime performance for customers. Hermes bytecode actually grew 3.5%, and the PR notes staging telemetry will show whether that affects startup. Neither number is something the help site claims or should claim. @elirangoshen, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
commented
Sep 22, 2026
|
Hey! On an iOS dev build, opening Create expense via the FAB throws Four packages with codegen specs are missing:
Anything bundled by Re.Pack is likely affected, so dev builds ( Screen.Recording.2026-09-22.at.13.22.09.mov |
commented
Sep 23, 2026
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.4.91-3 🚀
Bundle Size Analysis (Sentry): |
commented
Oct 14, 2026
|
Coming from #102623 checklist This PR added Fixed in #102681 by setting |
commented
Oct 14, 2026
yes we know it should be ok now |
Explanation of Change
This PR switches native (iOS/Android) JS bundling from Metro to Re.Pack (Rspack-based), with a Rust transform pipeline (OXC + SWC) for app source and almost all of
node_modules.What changed
pluginRepack(rock.config.mjs), with the bundler config atconfig/repack/rspack.config.mjsand a rootrspack.config.mjsre-export.node_modulesoutside a small allowlist are transformed by the same Rust pipeline:oxc-transform(React Compiler disabled for third-party code; Fast Refresh injection disabled fornode_modules, since Re.Pack's refresh runtime does not wrap them), thenworklets-loader(Reanimated worklets text-sniff), thencjs-inline-requires-loader(SWC CJS lowering + Metro-style inlined requires). All loaders run withparallel: trueworker pools.BABEL_PACKAGESallowlist (~23 packages) stays on Re.Pack'sbabel-swc-loaderwithhermes-parser: Flow-typed React Native core packages, packages that callcodegenNativeComponentin shipped JS (they need the RN Babel preset's codegen plugin to register Fabric view configs), and@callstack/repack's own runtime.cjs-inline-requires-loadergained two options:sourcemap: false: prebuilt packages ship multi-source maps that@jridgewell/remappingcannot compose.hermesLowering: true: addstransform-async-to-generator+transform-async-generator-functions, because Hermes cannot parse async generators. The full RN-preset lowering set was measured and rejected as pure size bloat.main(React Native 0.86,oxc-transform-react0.145).Why
Re.Pack previously ran
hermes-parseron every.jsfile. That parser is pathological on prebuilt, minified single-line files: 95s for one 0.5MB file vs 0.1s with@babel/parser. Metro never pays this cost because itshermesParseroption defaults tofalse.Results (same machine, same day; cold = cache wiped):
Hermes bytecode grew 3.5%. The likely cause is duplicated import wrappers from the inline-requires step; a contained loader fix is tracked as a follow-up, and staging ManualAppStartup telemetry will show whether it affects startup.
Known follow-ups
codegenNativeComponent/ Flow syntax on dependency bumps, so theBABEL_PACKAGESallowlist can't silently go stale.Fixed Issues
$ #100202
PROPOSAL: N/A (build tooling change, not a contributor proposal)
Automated Tests
No new automated tests: this PR changes the native bundling pipeline only, not runtime app code. Existing CI (typecheck, lint, Jest) covers the unchanged sources; the bundle itself is verified by building and booting each platform (see Tests).
Tests
developmentDebug)callstack-repackpod; verify the ScriptManager TurboModule loads on the hybrid RN host)hermesc -O(bytecode builds without errors).Offline tests
Bundling change only; no runtime network behavior is affected. Launch the app once online, then relaunch offline and verify it boots from the bundled JS and renders cached data normally.
QA Steps
Same as Tests (steps 1–2): build and boot each native platform, sign in, verify the LHN loads, open a report, and send a chat message.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari