DEV Community

Alex Spinov
Alex Spinov

Posted on

Rspack Has a Free Bundler: A Rust-Based Webpack Replacement That's 10x Faster With Drop-In Compatibility

Your webpack build takes 90 seconds. You've tried cache-loader, thread-loader, esbuild-loader, persistent caching. Maybe you shaved off 20 seconds. The core problem remains: webpack is single-threaded JavaScript processing millions of modules.

What if you could keep your webpack config — plugins, loaders, module.rules — and just make it 10x faster?

That's Rspack. A Rust-powered webpack replacement with near-complete configuration compatibility.

Performance: Rspack vs Webpack vs Vite

Operation Webpack 5 Rspack Vite
Cold start (large project) 35s 3.5s 1.2s*
HMR update 800ms 80ms 50ms
Production build 90s 9s 15s
With 10K modules 120s 12s N/A**

*Vite defers bundling to browser in dev, so cold start is fast but first page load is slower.
**Vite uses Rollup for production, which struggles with very large module counts.

Quick Start — New Project

npm create rspack@latest
cd rspack-project && npm install && npm run dev
Enter fullscreen mode Exit fullscreen mode

Migrate From Webpack — It's Almost the Same Config

// rspack.config.js — looks familiar?
const path = require("path");
const HtmlPlugin = require("html-webpack-plugin"); // Yes, webpack plugins work!

/** @type {import('@rspack/cli').Configuration} */
module.exports = {
  entry: "./src/index.tsx",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "[name].[contenthash].js",
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "builtin:swc-loader",  // Built-in SWC — no install needed
        type: "javascript/auto",
      },
      {
        test: /\.css$/,
        type: "css",  // Native CSS support — no css-loader needed
      },
      {
        test: /\.(png|jpg|svg)$/,
        type: "asset",  // Native asset handling
      },
    ],
  },
  plugins: [new HtmlPlugin({ template: "./index.html" })],
  resolve: {
    extensions: [".tsx", ".ts", ".js"],
  },
};
Enter fullscreen mode Exit fullscreen mode

Key differences from webpack:

  • builtin:swc-loader replaces babel-loader (10x faster, built in)
  • type: "css" replaces css-loader + style-loader
  • Most webpack plugins work as-is

What Webpack Plugins Work?

Plugin Status
HtmlWebpackPlugin Works
MiniCssExtractPlugin Built-in (type: "css")
DefinePlugin Built-in
CopyWebpackPlugin Works
webpack-bundle-analyzer Works
fork-ts-checker-webpack-plugin Works

Built-in Features (No Extra Packages)

module.exports = {
  builtins: {
    // Tree shaking — on by default
    treeShaking: true,

    // Code splitting
    optimization: {
      splitChunks: {
        chunks: "all",
        cacheGroups: {
          vendor: {
            test: /[\\/]node_modules[\\/]/,
            name: "vendors",
          },
        },
      },
    },
  },
};
Enter fullscreen mode Exit fullscreen mode

Migration Checklist

  1. npm install -D @rspack/cli @rspack/core
  2. Rename webpack.config.jsrspack.config.js
  3. Replace babel-loaderbuiltin:swc-loader
  4. Replace css-loader + style-loadertype: "css"
  5. Remove cache-loader, thread-loader (Rspack is already fast)
  6. Update package.json scripts: webpackrspack
  7. Test. Most configs work with these changes only.

When to Choose Rspack

Choose Rspack when:

  • You have an existing webpack project and want faster builds
  • Your project has 1,000+ modules where webpack slows down
  • You use webpack plugins/loaders that Vite doesn't support
  • You want production builds to match dev behavior exactly

Skip Rspack when:

  • New project with no webpack investment (consider Vite instead)
  • Small project where webpack is already fast enough
  • You need experimental features Vite ecosystem provides (like Islands)

The Bottom Line

Rspack is the webpack upgrade path nobody expected — same config, same plugins, 10x speed. If your webpack build time frustrates you, Rspack is a weekend migration.

Start here: rspack.dev


Need custom data extraction, scraping, or automation? I build tools that collect and process data at scale — 78 actors on Apify Store and 265+ open-source repos. Email me: Spinov001@gmail.com | My Apify Actors

Top comments (0)