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.
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.
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.
How to use
- Scaffold a new Rspack project:
npm create rspack@latest myapp
cd myapp
npm run dev
- Or migrate an existing webpack project by replacing the webpack dependency:
npm install -D @rspack/core @rspack/cli
- Rename
webpack.config.jstorspack.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' } } }
},
],
},
};
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.
Related on TokRepo
- Automation tools -- build tools and CI/CD automation
- Coding AI tools -- developer productivity tools
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-loaderis not the same as the standaloneswc-loadernpm package. Use the built-in version for best performance.
Frequently Asked Questions
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.
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.
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.
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.
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)
- Rspack GitHub— Rspack implements webpack loader and plugin API in Rust
- Rspack Documentation— SWC-based transpilation as webpack loader replacement
- Webpack Documentation— Webpack module bundling architecture
Related on TokRepo
Discussion
Related Assets
Flower — Federated Learning Framework for Any ML Platform
A unified framework for federated learning and federated analytics that works with PyTorch, TensorFlow, JAX, or any machine learning library.
H2O-3 — Scalable Open-Source Machine Learning Platform
An in-memory distributed machine learning platform with AutoML support, offering gradient boosting, deep learning, GLM, and more through Python, R, and Java APIs.
Open3D — Modern Library for 3D Data Processing
An open-source library for 3D data processing with fast implementations for point clouds, meshes, RGB-D images, and 3D visualization using both C++ and Python APIs.