Skip to content

Rspack support#186

Draft
ngranander wants to merge 3 commits intoaspect-build:mainfrom
ngranander:rspack
Draft

Rspack support#186
ngranander wants to merge 3 commits intoaspect-build:mainfrom
ngranander:rspack

Conversation

@ngranander
Copy link
Copy Markdown

Adds Rspack as an alternative bundler for webpack_bundle and webpack_devserver, addressing #159.

A new bundler parameter ("webpack" or "rspack", default "webpack") controls which bundler is used. When set to "rspack", the rules use @rspack/core and @rspack/cli instead of webpack and webpack-cli, via a new rspack_binary macro that mirrors the existing webpack_binary.

Config merging:
Rspack CLI doesn't support --merge, so when a custom webpack_config is provided it replaces the generated base config entirely. Without a custom config the generated base config is used as-is. This is documented in the bundler param docstrings and the README.

Performance:
Rspack's Rust-based architecture provides significant speedups over webpack. In published benchmarks rspack is 4-6x faster for production builds and up to 15x+ faster for dev startup on larger projects. In a real-world production web application (~10k modules with SWC loaders, CSS extraction, and code splitting), we measured approximately 2.3x (dev) and 3.2x (prod) end-to-end Bazel build speedup.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

New: webpack_bundle and webpack_devserver now support Rspack as a drop-in alternative bundler. Set bundler = "rspack" and ensure @rspack/core and @rspack/cli are linked in your node_modules. See the README for details.

Test plan

  • Covered by existing test cases
  • New test cases added
    • webpack/tests/simple: rspack with custom config and with generated config
    • webpack/tests/devtool-override: rspack with devtool override
    • webpack/tests/worker: rspack with workers enabled
    • webpack/tests/devserver: rspack devserver target
    • e2e/smoke: rspack end-to-end smoke test with production-mode output comparison

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 16, 2026

CLA assistant check
All committers have signed the CLA.

@aspect-workflows
Copy link
Copy Markdown

aspect-workflows Bot commented Apr 16, 2026

Test

1 test target passed

Targets
//docs:update_test [k8-fastbuild] 102ms

Total test execution time was 102ms. 19 tests (95.0%) were fully cached saving 2s.


Test

e2e/loaders

All tests were cache hits

1 test (100.0%) was fully cached saving 44ms.


Test

e2e/loaders_jslib

All tests were cache hits

1 test (100.0%) was fully cached saving 38ms.


Test

e2e/smoke

All tests were cache hits

3 tests (100.0%) were fully cached saving 173ms.


Test

e2e/smoke_rjs3

All tests were cache hits

1 test (100.0%) was fully cached saving 45ms.


Test

e2e/worker

All tests were cache hits

2 tests (100.0%) were fully cached saving 124ms.


Buildifier

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.

2 participants