Skip to main content
Ganesh Joshi
Back to Blogs

Turbopack in Next.js: faster local development

February 15, 20264 min read
Tutorials
Terminal or build output on screen

Turbopack is a Rust-based bundler that dramatically speeds up Next.js development. Written by the team behind Webpack, it's designed for instant feedback loops—cold starts in milliseconds and hot module replacement (HMR) that feels instant even in large codebases.

Why Turbopack?

Development servers spend time bundling and transforming code. As projects grow, this slows down:

Codebase size Webpack cold start Turbopack cold start
Small (100 modules) ~2s ~0.5s
Medium (1,000 modules) ~10s ~1s
Large (10,000 modules) ~60s ~5s

HMR improvements are even more dramatic—updates that took seconds with Webpack happen in milliseconds with Turbopack.

How it works

Turbopack uses several techniques:

Technique Benefit
Incremental computation Only recomputes what changed
Demand-driven Compiles only what's needed for current page
Native speed Rust is faster than JavaScript
Persistent caching Remembers work across restarts

Instead of bundling everything upfront, Turbopack compiles on demand and caches aggressively.

Enabling Turbopack

Development (stable)

Add --turbo to your dev command:

{
  "scripts": {
    "dev": "next dev --turbo"
  }
}

Or run directly:

npx next dev --turbo

Production builds (beta)

As of Next.js 15, production builds with Turbopack are in beta:

{
  "scripts": {
    "build": "next build --turbo"
  }
}

Check the Next.js Turbopack docs for current status.

What gets faster

Cold start

Starting the dev server:

# Without Turbopack
$ next dev
▲ Next.js 15.0.0
- Local: http://localhost:3000
Ready in 8.2s

# With Turbopack
$ next dev --turbo
▲ Next.js 15.0.0 (Turbopack)
- Local: http://localhost:3000
Ready in 1.1s

Hot Module Replacement

After editing a file:

Edit type Webpack Turbopack
CSS change ~500ms ~10ms
Component change ~1-2s ~50ms
Route change ~2-5s ~100ms

The improvement is most noticeable in large codebases.

First page load

Turbopack compiles only the requested route:

# Requesting /dashboard
GET /dashboard 200 in 150ms

# Only dashboard code compiled, not entire app

Feature support

Turbopack supports all major Next.js features:

Feature Support
App Router
Pages Router
Server Components
Server Actions
CSS Modules
Tailwind CSS
TypeScript
MDX
Image optimization

What's not supported (yet)

Some Webpack-specific features have limited support:

Feature Status
Custom Webpack config Partial
Webpack plugins Limited
next.config.js webpack() May not work
Some loaders Check compatibility

If you rely on custom Webpack configuration, test thoroughly.

Fallback strategy

If Turbopack doesn't work with your setup:

{
  "scripts": {
    "dev": "next dev --turbo",
    "dev:webpack": "next dev"
  }
}

Run dev:webpack as a fallback when needed.

Configuration

Most configuration works the same. For Turbopack-specific options:

// next.config.js
module.exports = {
  experimental: {
    turbo: {
      rules: {
        // Custom loaders (if needed)
        '*.svg': {
          loaders: ['@svgr/webpack'],
          as: '*.js',
        },
      },
    },
  },
};

Monorepo usage

Turbopack works well in monorepos:

# From monorepo root
cd apps/web
npm run dev  # Uses Turbopack if configured

Combined with Turborepo for task orchestration, you get fast dev servers and cached builds.

Measuring improvement

Compare startup and HMR times:

# Time cold start
time next dev --turbo

# Watch terminal for HMR times
# "Fast Refresh in Xms"

For large projects, the difference is substantial.

Troubleshooting

"Module not found" errors

Clear the Turbopack cache:

rm -rf .next

Slow first compile

First request compiles the route. Subsequent requests are cached:

GET / 200 in 2500ms  # First request
GET / 200 in 50ms    # Cached

Plugin compatibility

If a Webpack plugin doesn't work:

  1. Check if there's a Turbopack alternative
  2. Use the plugin only in production builds
  3. Fall back to next dev without --turbo

IDE integration

VS Code extension for Next.js works with Turbopack. Terminal output shows Turbopack-specific info:

▲ Next.js 15.0.0 (Turbopack)
- Local: http://localhost:3000
- Network: http://192.168.1.100:3000

○ Compiling / ...
✓ Compiled / in 450ms

Comparison with Vite

Aspect Turbopack Vite
Language Rust JavaScript/Go (esbuild)
Framework Next.js focused Framework agnostic
HMR Very fast Fast
Production Beta Stable
Ecosystem Growing Mature

Use Turbopack for Next.js projects; consider Vite for other frameworks.

Summary

Turbopack dramatically speeds up Next.js development with Rust-based incremental compilation. Enable it with next dev --turbo for instant HMR and fast cold starts. Production builds are in beta. Most Next.js features work; check compatibility for custom Webpack config. The improvement is most noticeable in large codebases where traditional bundlers struggle.

Frequently Asked Questions

Turbopack is a Rust-based bundler created by Vercel. It's designed as a successor to Webpack with significantly faster incremental compilation, especially for large codebases.

Run next dev --turbo to use Turbopack for development. In Next.js 15+, Turbopack is stable for dev. Add the flag to your dev script in package.json.

Yes, significantly for incremental updates. Cold starts can be 5-10x faster, and HMR updates can be 10-100x faster depending on project size. The benefits grow with codebase size.

Turbopack for production builds (next build --turbo) is in beta as of Next.js 15. Check the Next.js docs for current status. Development use is stable.

Some Webpack-specific plugins aren't supported yet. Test with --turbo flag; if something breaks, use next dev without the flag as fallback. Core Next.js features work.

Related Posts