← Back to archive

Repo of the Day

web-infra-dev/rspack

Published: Feb 19, 2024

Open repository ↗

A fast Rust-based web bundler 🦀️

Summary

Rspack is a Rust-based bundler for the web that modernizes the webpack API, aiming to be a drop-in replacement while delivering faster startup and HMR. It is published as @rspack/core on npm and is part of a broader "Rstack" toolchain that includes Rsbuild, Rslib, Rspress, Rsdoctor, Rstest, and Rslint. The project is MIT licensed and ships separate documentation streams for the 0.x, 1.x, and 2.x releases.

What it is useful for

Rspack fits projects that already use webpack but want faster cold starts and incremental rebuilds without rewriting their build configuration. Its webpack-compatible plugin and loader ecosystem means teams can keep existing tooling while changing only the bundler. It is framework agnostic, so it is usable with React, Vue, Preact, or plain JS/TS codebases.

It also includes first-class support for Module Federation, which is relevant for teams building large web apps composed of independently deployed micro-frontends. Built-in production optimizations (such as tree shaking and minification) remove the need to wire up those steps manually for typical apps.

A useful caveat from the README: not every webpack plugin works unchanged. The maintainers explicitly maintain @rspack/html-plugin as a fork of html-webpack-plugin to work around webpack API surface that is not yet supported in Rspack, so teams with unusual or deeply customized webpack plugins should expect to do some validation.

How engineers can use it

The README does not print a copy-pasteable install command; it points to the Quick start guide and provides a StackBlitz template. A reasonable starting point, based on the npm badge, is installing @rspack/core from npm and writing a config that mirrors a typical webpack setup, including loader rules and plugin entries.

For an actual hands-on:

  1. Open the StackBlitz example linked in the README to see a working rspack.config.js and project layout.
  2. Follow the Quick start guide for the version line you target (2.x is the current docs; 1.x and 0.x docs are also linked).
  3. Port an existing webpack config by renaming webpack references to @rspack/core and validating that any custom plugins are either compatible or have an rspack-specific equivalent (for example, the rspack plugin react/preact refresh implementations).
  4. Add @rspack/dev-server for local development, since it is listed as a separate repository under the same organization.
  5. For CI and historical comparisons, use the build-tools-performance and ecosystem-benchmark.rspack.rs links in the README to compare Rspack against other bundlers.

If anything beyond the basics is needed (React refresh, CSS extraction, subresource integrity, copy plugin), the README points to rspack-specific plugin packages rather than the original webpack ones, which is worth knowing up front.