DEV Community

Alex Spinov
Alex Spinov

Posted on

Rspack Has a Free Webpack-Compatible Bundler — 10x Faster Builds

Your webpack builds take 30 seconds. Rspack does the same in 3.

What is Rspack?

Rspack is a high-performance bundler written in Rust, designed as a drop-in replacement for webpack. Same config format, same plugin API, same loader compatibility — just 5-10x faster.

Built by the ByteDance web infra team (the company behind TikTok), Rspack now powers thousands of internal projects.

Why Rspack Is Taking Over

1. Drop-In Webpack Replacement

// rspack.config.js — looks exactly like webpack.config.js
module.exports = {
  entry: './src/index.tsx',
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'builtin:swc-loader',
        options: {
          jsc: { parser: { syntax: 'typescript', tsx: true } }
        }
      },
      {
        test: /\.css$/,
        type: 'css',
      }
    ]
  },
  output: {
    filename: '[name].[contenthash].js',
    path: './dist'
  }
};
Enter fullscreen mode Exit fullscreen mode

2. Built-in SWC Loader

No need for babel-loader + @babel/preset-env + @babel/preset-react + @babel/preset-typescript. Rspack includes SWC natively:

{
  test: /\.[jt]sx?$/,
  use: {
    loader: 'builtin:swc-loader',
    options: {
      jsc: {
        parser: { syntax: 'typescript', tsx: true },
        transform: { react: { runtime: 'automatic' } }
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

One loader replaces four.

3. Webpack Plugin Compatibility

const rspack = require('@rspack/core');

module.exports = {
  plugins: [
    new rspack.HtmlRspackPlugin({ template: './index.html' }),
    new rspack.CopyRspackPlugin({ patterns: [{ from: 'public' }] }),
    // Most webpack plugins work too
    new (require('webpack-bundle-analyzer').BundleAnalyzerPlugin)(),
  ]
};
Enter fullscreen mode Exit fullscreen mode

4. Module Federation 2.0

const { ModuleFederationPlugin } = require('@module-federation/enhanced/rspack');

module.exports = {
  plugins: [
    new ModuleFederationPlugin({
      name: 'app1',
      exposes: { './Button': './src/Button' },
      shared: ['react', 'react-dom'],
    })
  ]
};
Enter fullscreen mode Exit fullscreen mode

5. CSS Support Without Loaders

module.exports = {
  module: {
    rules: [
      { test: /\.css$/, type: 'css' },
      { test: /\.module\.css$/, type: 'css/module' },
    ]
  },
  experiments: {
    css: true
  }
};
Enter fullscreen mode Exit fullscreen mode

No css-loader, style-loader, or mini-css-extract-plugin. Built in.

Performance Benchmarks

Metric Webpack 5 Rspack
Cold start 30s 3s
HMR 500ms 50ms
Production build 60s 8s
Memory usage 1.5GB 400MB

Based on a large React app with 10K+ modules

Migration from Webpack

# Install
npm install @rspack/core @rspack/cli -D

# Rename config
mv webpack.config.js rspack.config.js

# Replace built-in plugins
# HtmlWebpackPlugin → rspack.HtmlRspackPlugin
# MiniCssExtractPlugin → type: 'css' (built-in)

# Update scripts
# "build": "webpack" → "build": "rspack build"
# "dev": "webpack serve" → "dev": "rspack serve"
Enter fullscreen mode Exit fullscreen mode

Most projects migrate in under an hour.

The Bottom Line

Rspack gives you webpack's ecosystem with Rust's speed. If your builds are slow and you can't rewrite your webpack config for Vite — Rspack is the answer.


Need data extraction tools? I build custom web scraping solutions. Check my Apify actors or email spinov001@gmail.com.

Top comments (0)