ConfigsApr 14, 2026·3 min read

Rspack — A Fast Rust-Based Webpack-Compatible Bundler

Rspack is a Rust-powered drop-in replacement for webpack. It implements the webpack loader and plugin API natively, giving webpack shops 5–10x faster builds without rewriting configuration or tooling.

TL;DR
Rspack gives webpack-compatible projects 5-10x faster builds by reimplementing the bundler in Rust.
§01

What it is

Rspack is a JavaScript bundler written in Rust that implements the webpack loader and plugin API. Built by ByteDance's web infra team, it lets existing webpack projects migrate with minimal configuration changes while gaining significant build speed improvements.

Rspack targets frontend teams already invested in webpack who cannot justify a full migration to Vite or Turbopack. If you have hundreds of webpack loaders and plugins in production, Rspack lets you keep them and still get Rust-level performance.

§02

How it saves time or tokens

Rspack's primary value is build speed. A project that takes 60 seconds to build with webpack can often complete in 6-12 seconds with Rspack. This compounds across a team: faster CI pipelines, faster local dev server startup, and faster hot module replacement (HMR) during development.

Because Rspack is API-compatible with webpack, migration cost is low. Teams do not need to rewrite their build configuration or replace custom plugins. The time saved on migration alone can be measured in weeks compared to switching to a fundamentally different bundler.

§03

How to use

  1. Scaffold a new Rspack project:
npm create rspack@latest myapp
cd myapp
npm run dev
  1. Or migrate an existing webpack project by replacing the webpack dependency:
npm install -D @rspack/core @rspack/cli
  1. Rename webpack.config.js to rspack.config.js (or keep it and point the CLI at it). Most webpack configurations work without changes:
// rspack.config.js
module.exports = {
  entry: './src/index.ts',
  output: { path: __dirname + '/dist', filename: 'bundle.js' },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: 'builtin:swc-loader',
        options: { jsc: { parser: { syntax: 'typescript' } } }
      },
    ],
  },
};
§04

Example

A typical React + TypeScript project configuration:

const { HtmlRspackPlugin } = require('@rspack/core');

module.exports = {
  entry: './src/main.tsx',
  resolve: { extensions: ['.tsx', '.ts', '.js'] },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: 'builtin:swc-loader',
        options: {
          jsc: { parser: { syntax: 'typescript', tsx: true } },
        },
      },
    ],
  },
  plugins: [new HtmlRspackPlugin({ template: './index.html' })],
};

Run npx rspack serve for development with HMR, or npx rspack build for production.

§05

Related on TokRepo

§06

Common pitfalls

  • Not all webpack plugins are compatible. Plugins that rely on internal webpack APIs or monkey-patch the compiler may fail. Check the Rspack compatibility list before migrating.
  • Rspack uses SWC instead of Babel by default. If your project depends on Babel plugins for JSX transforms or decorators, you need to configure the SWC equivalents.
  • The builtin:swc-loader is not the same as the standalone swc-loader npm package. Use the built-in version for best performance.

Frequently Asked Questions

Is Rspack fully compatible with webpack?+

Rspack implements the core webpack loader and plugin API, and most webpack configurations work without changes. However, plugins that depend on undocumented internal webpack APIs may need adjustments. The Rspack team maintains a compatibility tracker in their documentation.

How much faster is Rspack compared to webpack?+

Rspack typically delivers 5-10x faster builds depending on project size and complexity. The improvement is most noticeable in large projects with many modules. HMR updates are often sub-100ms compared to multi-second updates in webpack.

Can I use Rspack with React, Vue, or Angular?+

Rspack works with React and Vue out of the box via its built-in SWC loader. Angular support is more limited since Angular CLI has its own build system. For React and Vue projects migrating from webpack, Rspack is a direct path.

Who maintains Rspack?+

Rspack is developed by ByteDance's web infrastructure team and is open source under the MIT license. ByteDance uses Rspack internally across many of its web properties, which drives active maintenance and feature development.

Does Rspack support code splitting and lazy loading?+

Yes. Rspack supports dynamic imports, code splitting, and lazy loading with the same configuration syntax as webpack. Features like splitChunks optimization work identically.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets