Skip to main content

Command Palette

Search for a command to run...

Build Tools in 2026: Vite, Turbopack, Rspack, and Webpack

Published
11 min read
D
Practical guides for developers: TypeScript, developer tools, CI/CD, and modern web development. We cover the tools that make devs more productive.

Build Tools in 2026: Vite, Turbopack, Rspack, and Webpack

The JavaScript build tool landscape has shifted dramatically. Webpack dominated for a decade, but the performance ceiling of a JavaScript-based bundler became impossible to ignore. Vite, Turbopack, Rspack, and esbuild each attacked that problem differently. Here's where things stand, what to use for new projects, and when migration from Webpack actually makes sense.

Vite next-generation frontend build tool logo

The State of Play

ToolLanguagePrimary Use CaseWebpack Plugin CompatProduction Bundler
ViteTypeScript (Rollup/Rolldown)General-purpose dev + buildNoRollup (migrating to Rolldown)
TurbopackRustNext.js dev serverNoNot yet (still uses Webpack)
RspackRustWebpack replacementYes (most)Yes
esbuildGoLibrary bundling, toolingNoYes (limited)
WebpackJavaScriptLegacy, complex buildsYes (all)Yes

The biggest takeaway: there is no single "best" build tool. The right choice depends on your framework, your existing configuration, and whether you need development speed or production optimization more urgently.

Vite: The Default Choice for New Projects

Vite won the general-purpose build tool war. It's the default for React (via create-vite), Vue, Svelte, SolidJS, and most other frameworks outside the Next.js ecosystem. The reasons are straightforward:

  • Dev server startup is near-instant regardless of project size, thanks to native ESM serving and on-demand compilation
  • HMR is fast -- changes reflect in the browser in under 50ms for most edits
  • Configuration is minimal for common setups -- React, Vue, and TypeScript work out of the box
  • Plugin ecosystem is mature with hundreds of well-maintained plugins

Basic Vite Setup

bun create vite my-app --template react-ts
cd my-app
bun install
bun run dev

Vite Configuration That Actually Matters

Most Vite projects need minimal configuration. Here's a vite.config.ts that covers the common customizations:

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  server: {
    port: 3000,
    proxy: {
      "/api": {
        target: "http://localhost:8080",
        changeOrigin: true,
      },
    },
  },
  build: {
    target: "es2022",
    sourcemap: true,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ["react", "react-dom"],
        },
      },
    },
  },
});

When Vite Falls Short

Vite's development server uses native ESM -- it serves individual modules to the browser rather than bundling them. For most projects this is fast, but there are edge cases:

  • Very large dependency trees: If your app imports hundreds of modules on initial load, the browser's module loading can actually be slower than a bundled approach. Vite's dependency pre-bundling (via esbuild) mitigates this, but extremely complex apps can still feel sluggish on first load.
  • Production uses Rollup: The dev and production pipelines use different tools (esbuild for dev transforms, Rollup for production bundles). Occasionally you'll hit a case where something works in dev but breaks in production. This is being addressed by the migration to Rolldown, a Rust-based Rollup replacement that will unify both pipelines.
  • SSR is workable but not seamless: Vite's SSR support works, but frameworks like Next.js and Remix have deeper SSR integration with their own build tooling.

The Rolldown Migration

Vite is actively migrating its production bundler from Rollup to Rolldown -- a Rust port of Rollup that maintains API compatibility while being significantly faster. This is expected to land as the default in Vite 7. The practical impact:

  • Production builds will be 5-10x faster
  • Dev and production will use the same underlying engine, eliminating the "works in dev, breaks in prod" class of bugs
  • Rollup plugins will continue to work (Rolldown maintains Rollup's plugin API)

If you're choosing Vite today, this migration is a reason for confidence, not concern.

Turbopack: Next.js Only (For Now)

Turbopack is Vercel's Rust-based bundler, built specifically for Next.js. It replaced Webpack as the default development bundler in Next.js 15.

What Turbopack Does Well

  • Dev server speed in Next.js: Turbopack's incremental compilation makes HMR in large Next.js projects dramatically faster than the old Webpack-based dev server
  • Deep integration with Next.js features: App Router, Server Components, and server actions are first-class concerns in Turbopack's architecture

Current Limitations

Turbopack is not a general-purpose build tool. You cannot use it outside Next.js. As of early 2026:

  • Production builds still use Webpack: next build does not use Turbopack yet. Only next dev --turbopack uses it.
  • No standalone usage: There's no turbopack build CLI for non-Next.js projects
  • Plugin ecosystem is nonexistent: You can't bring Webpack or Vite plugins to Turbopack
# Enable Turbopack for Next.js development
next dev --turbopack

Should You Use Turbopack?

If you're using Next.js 15+, Turbopack is enabled by default for next dev. There's no reason to opt out -- it's faster and stable for development. But understand that this is a Next.js-specific tool. If you're evaluating build tools for a non-Next.js project, Turbopack isn't an option.

Rspack: The Webpack Migration Path

Rspack is the most interesting build tool for teams with large existing Webpack configurations. Built by the ByteDance web infra team in Rust, it implements the Webpack API and supports most Webpack plugins and loaders directly.

Why Rspack Matters

The pitch is simple: take your existing webpack.config.js, change the import, and get 5-10x faster builds with minimal code changes.

// Before: webpack.config.js
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  entry: "./src/index.tsx",
  plugins: [new HtmlWebpackPlugin({ template: "./index.html" })],
  module: {
    rules: [
      { test: /\.tsx?$/, use: "babel-loader" },
      { test: /\.css$/, use: ["style-loader", "css-loader"] },
    ],
  },
};
// After: rspack.config.js
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { defineConfig } = require("@rspack/cli");

module.exports = defineConfig({
  entry: "./src/index.tsx",
  plugins: [new HtmlWebpackPlugin({ template: "./index.html" })],
  module: {
    rules: [
      { test: /\.tsx?$/, use: "builtin:swc-loader" },
      { test: /\.css$/, use: ["style-loader", "css-loader"] },
    ],
  },
});

The key change: replace babel-loader with builtin:swc-loader for a massive speed improvement. Most other loaders and plugins work unchanged.

Rspack Compatibility

Webpack FeatureRspack Support
Entry/output configurationFull
Loaders (css-loader, file-loader, etc.)Most work directly
HtmlWebpackPluginYes
MiniCssExtractPluginBuilt-in alternative (rspack.CssExtractRspackPlugin)
DefinePluginBuilt-in
Code splitting / dynamic importsFull
Module FederationYes (enhanced version)
Custom plugins using compiler hooksMost hooks supported
babel-loaderWorks, but use builtin:swc-loader instead

When to Choose Rspack

  • You have a complex Webpack configuration with custom plugins and loaders
  • Migrating to Vite would require rewriting significant build configuration
  • Build times are a pain point and you need improvement without a full rewrite
  • You use Module Federation (Rspack's implementation is arguably better than Webpack's)

Installation and Migration

bun add -D @rspack/core @rspack/cli

# Rename webpack.config.js to rspack.config.js
# Update the imports and replace babel-loader with builtin:swc-loader
# Run with:
bunx rspack serve   # dev server
bunx rspack build   # production build

esbuild: The Library Bundler

esbuild isn't trying to replace Vite or Webpack for application development. It's a low-level, extremely fast bundler written in Go that excels at specific tasks:

  • Library bundling: If you're publishing an npm package, esbuild produces clean ESM and CJS output with minimal configuration
  • Tooling infrastructure: Vite uses esbuild for dependency pre-bundling and TypeScript/JSX transforms
  • Simple build scripts: When you need to bundle a TypeScript file into a single JavaScript output without a complex configuration file

Library Bundling with esbuild

// build.ts
import { build } from "esbuild";

await build({
  entryPoints: ["src/index.ts"],
  bundle: true,
  outfile: "dist/index.js",
  format: "esm",
  platform: "node",
  target: "node20",
  external: ["react", "react-dom"],  // peer dependencies
  sourcemap: true,
  minify: false,  // don't minify libraries
});
bun run build.ts

When esbuild Is Not the Right Choice

  • Application bundling: esbuild's code splitting is limited compared to Rollup or Webpack. It doesn't handle CSS extraction, asset management, or the hundreds of edge cases that application bundlers deal with.
  • When you need plugins: esbuild's plugin API is minimal. If you need PostCSS, Tailwind processing, image optimization, or complex transforms, use a higher-level tool.

Webpack: The Legacy Workhorse

Webpack is no longer the right choice for new projects. But it's still the right choice for many existing ones, and understanding when to stay on Webpack is as important as knowing when to migrate.

When to Stay on Webpack

  • Your build works and isn't slow enough to justify migration effort: If your Webpack build takes 30 seconds and your team ships features on it daily, the ROI of migration is low.
  • You depend on Webpack-specific plugins with no equivalent: Some enterprise tools, custom Module Federation setups, or specialized loaders only exist for Webpack.
  • You're using Next.js for production builds: next build still uses Webpack internally. You don't control this.

When to Migrate Away

  • Build times exceed 60 seconds and are impacting developer productivity
  • You're starting a new feature or app within a monorepo -- use Vite or Rspack for it
  • Your Webpack configuration has become unmaintainable (hundreds of lines, multiple merge strategies, environment-specific overrides)

Migration Strategies

To Vite (clean break):

bun add -D vite @vitejs/plugin-react

Expect to rewrite your build configuration from scratch. Vite's configuration model is fundamentally different from Webpack's. Budget 1-3 days for a medium-sized application depending on how many custom Webpack plugins you use.

To Rspack (incremental):

bun add -D @rspack/core @rspack/cli

This is the lower-risk path. Your existing configuration mostly transfers. Budget a few hours for initial migration, then iterate on replacing loaders with built-in Rspack alternatives for additional speed gains.

Performance Comparison

Real-world numbers vary enormously by project size and configuration, but here are representative benchmarks for a medium React application (~500 components, ~200 routes):

MetricWebpack 5Vite 6RspackTurbopack (dev)
Dev server cold start12-18s0.5-1.5s1-3s0.8-2s
HMR update500-2000ms30-80ms50-150ms30-100ms
Production build45-90s20-40s8-15sN/A
Memory usage (dev)800MB-1.5GB300-500MB400-600MB350-550MB

These numbers favor Vite and Turbopack for dev server experience, and Rspack for production build speed. Webpack is consistently the slowest across every metric.

Decision Framework

Use this to pick a build tool for your next project or migration:

Starting a new project (not Next.js)? Use Vite. It's the ecosystem default, has excellent documentation, and the Rolldown migration will only make it faster.

Starting a new Next.js project? Turbopack is already your dev bundler. No action needed.

Have an existing Webpack project with complex config? Evaluate Rspack first. The migration cost is dramatically lower than moving to Vite, and the speed improvements are substantial.

Have an existing Webpack project with simple config? Consider Vite. If your Webpack config is mostly default settings with a few loaders, Vite's simpler model will be easier to maintain long-term.

Building an npm library? Use esbuild directly or a library-focused tool like tsup (which wraps esbuild). Application bundlers add unnecessary complexity for library output.

Build works fine and nobody is complaining? Don't migrate. Spend your engineering time on product features instead. The best build tool is the one that gets out of your way, even if it's Webpack.

Configuration Tips

Vite: Speed Up Dependency Pre-bundling

If Vite's dev server is slow on first load, you're probably missing optimized dependencies. Force pre-bundling:

// vite.config.ts
export default defineConfig({
  optimizeDeps: {
    include: ["lodash-es", "axios", "@mui/material"],
  },
});

Rspack: Replace Loaders with Built-ins

Rspack has built-in support for several common loaders. Using the built-in versions is faster than their JavaScript equivalents:

// rspack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "builtin:swc-loader",  // replaces babel-loader + ts-loader
        options: {
          jsc: {
            parser: { syntax: "typescript", tsx: true },
            transform: { react: { runtime: "automatic" } },
          },
        },
      },
    ],
  },
  builtins: {
    css: { modules: { localIdentName: "[local]-[hash:6]" } },
  },
};

esbuild: Watch Mode for Development

For simple projects where Vite is overkill:

bunx esbuild src/index.ts --bundle --outfile=dist/index.js --watch --sourcemap

Webpack: Speed Up Without Migrating

If you're stuck on Webpack, these changes give the biggest speed improvements:

// webpack.config.js
module.exports = {
  cache: {
    type: "filesystem",  // persistent cache across builds
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "swc-loader",  // replace babel-loader with swc-loader
      },
    ],
  },
  experiments: {
    lazyCompilation: true,  // only compile modules when they're accessed
  },
};

Replacing babel-loader with swc-loader alone can cut build times by 40-60%.

The Bottom Line

Vite is the safe default for new projects. Rspack is the pragmatic choice for Webpack migrations. Turbopack is what Next.js gives you. esbuild is for libraries. Webpack is for projects where migration isn't worth the cost yet.

The build tool ecosystem is converging on Rust-based tooling with JavaScript API compatibility. Whether that's Rolldown (under Vite), Rspack (Webpack-compatible), or Turbopack (Next.js), the direction is clear: Rust for performance, JavaScript for configuration. Pick the tool that fits your project today, knowing that the performance floor is rising across the board.


Enjoyed this guide? Subscribe to DevTools Guide — a free weekly newsletter covering developer tools, workflows, and best practices.

More from this blog

DevTools Guide

183 posts