DEV Community

Alex Spinov
Alex Spinov

Posted on

Rspack Has a Free Webpack-Compatible Bundler — 10x Faster Builds Without Changing Your Config

Why Rspack?

Rspack is a Webpack-compatible bundler written in Rust. Drop it into existing Webpack projects for 5-10x faster builds — same config, same plugins, same loaders.

npm install @rspack/cli @rspack/core
Enter fullscreen mode Exit fullscreen mode

rspack.config.js (Webpack-Compatible)

module.exports = {
  entry: './src/index.js',
  output: { filename: 'bundle.js', path: __dirname + '/dist' },
  module: {
    rules: [
      { test: /\.tsx?$/, use: 'builtin:swc-loader',
        options: { jsc: { parser: { syntax: 'typescript', tsx: true } } } },
      { test: /\.css$/, type: 'css' },
    ],
  },
  plugins: [new (require('@rspack/core').HtmlRspackPlugin)()],
}
Enter fullscreen mode Exit fullscreen mode

Migration from Webpack

  1. Replace webpack with @rspack/core in imports
  2. Replace webpack-cli with @rspack/cli
  3. Rename webpack.config.js to rspack.config.js
  4. Most loaders/plugins work unchanged

Speed Comparison

Project Webpack Rspack
Dev start 12s 1.2s
HMR 500ms 50ms
Production 45s 5s

Rspack vs Vite vs Webpack

Feature Rspack Vite Webpack
Speed 10x Webpack Very fast Baseline
Compat Webpack API Rollup API Native
Migration Drop-in Rewrite N/A
Ecosystem Webpack plugins Vite plugins Massive

Need to extract data from any website at scale? I build custom web scrapers — 77 production scrapers running on Apify Store. Email me at spinov001@gmail.com for a tailored solution.

Top comments (0)