Menu

What Is Turbopack? How Next.js's Rust Bundler Avoids Doing Work Twice
📰

What Is Turbopack? How Next.js's Rust Bundler Avoids Doing Work Twice

DEV Community: rust·Mohsen Fallahnejad·about 10 hours ago
#XbtW8zdy
#devtorust#devto#dev#turbopack#next
Reading 0:00
15s threshold

I built this blog twice in a row. The first next build compiled in 2.8 seconds . The second, with no code changes, compiled in 0.45 seconds . Same code, same machine. The difference is the whole idea behind Turbopack.

The mental model

Turbopack is a chef who never chops the same onion twice . Every small prep step is labeled and kept in the fridge. When you change one recipe, the chef redoes only the steps that used the changed ingredient and reuses everything else.

A bundler is the tool that turns your source files (TypeScript, JSX, CSS) into the files the browser and server actually run. Turbopack is the bundler built into Next.js, written in Rust, and it's the default since Next.js 16. (If you're unsure what a bundler does next to npm or Bun, see who does what in a JavaScript kitchen .)

How it works

1. It breaks the work into tiny labeled steps

Bundling is many small jobs: read a file, parse it, compile its JSX, find its imports, build a chunk.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.