Skip to content

feat: bring lazy platform compilation to Rspack - #1430

Open
jbroma wants to merge 23 commits into
callstack:mainfrom
jbroma:feat/lazy-compilation
Open

feat: bring lazy platform compilation to Rspack#1430
jbroma wants to merge 23 commits into
callstack:mainfrom
jbroma:feat/lazy-compilation

Conversation

@jbroma

@jbroma jbroma commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Bring the Rspack development experience to parity with Webpack by compiling each configured platform only when its bundle is first requested.

Developer wins

  • The development server starts without eagerly compiling every configured platform.
  • Launching an iOS app no longer waits for an unused Android build, and vice versa.
  • Each platform keeps independent compilation state, progress reporting, HMR notifications, stats, and asset caching.
  • A platform compiles once on first request, then serves subsequent bundle requests from the existing cache until a source change triggers a rebuild.
  • Shutdown now closes Rspack cleanly, rejects pending bundle requests, and still stops the development server when compiler shutdown fails.

How it works

Rspack starts every child compiler in a multi-compiler eagerly. Re.Pack now holds each child compiler at its initial watch run and releases it on the first bundle request for that platform. The watcher timestamps are refreshed when a gate is released to prevent the deferred compiler from treating changes made during startup as a second, phantom rebuild.

Unsupported platforms fail immediately instead of leaving requests pending. The implementation also tracks compilation, assets, stats, and request resolvers per platform.

Validation

  • Focused lazy-compilation compiler tests: 5/5 passed
  • Tester app dev-server integration tests: 2/2 passed
  • Re.Pack TypeScript and Biome checks passed
  • iOS smoke test passed
  • Watcher behavior verified with Rspack 1.6, 2.0, and 2.1
  • Changeset validation passed

@changeset-bot

changeset-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5e84c5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Minor
@callstack/repack-plugin-expo-modules Minor
@callstack/repack-plugin-nativewind Minor
@callstack/repack-plugin-reanimated Minor
@callstack/repack-dev-server Minor
@callstack/repack-init Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

@jbroma is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant