All posts
rustnextjstooling

Six Months of Turbopack as the Default Bundler

Next.js 16 switched both dev and build to Turbopack. What got faster, the webpack config I had to translate, and the one escape hatch worth knowing before you need it.

Muhamad Choirul Adam 3 min readPhoto: Unsplash

When Next.js 16 came out in October, Turbopack became the default for next dev and next build. No flag, no config. Every Next.js project I've touched since has run on it, including a production dashboard with a few hundred routes and this site.

Here's what six months looks like.

What got faster

The dev server is where I feel it most. Fast Refresh after an edit is close to instant, even in the big dashboard, and opening a route I haven't visited yet no longer means waiting for webpack to compile it.

Production builds got faster too, though less dramatically. The bigger win there was predictability: build time stopped creeping up every time we added a dependency.

Turbopack also caches to disk under .next, so restarting next dev picks up where it left off instead of recompiling everything.

What I had to translate

Turbopack doesn't run a webpack() function from next.config.ts. If your config has one, next build in Next.js 16 fails instead of silently ignoring it. That's the right call, and it's where most of the upgrade work is. Watch for plugins, too: a wrapper like a bundle analyzer can add a webpack option you never wrote.

Webpack loaders map to turbopack.rules. This site runs Tailwind's CSS through its Turbopack loader:

next.config.ts
const nextConfig = {
  turbopack: {
    rules: {
      "*.css": {
        loaders: ["@tailwindcss/turbopack"],
        as: "*.css",
      },
    },
  },
};

The less obvious change was the MDX setup. Turbopack passes loader options across to Rust, so they have to be serializable. Remark and rehype plugins can't be imported functions anymore; they're referenced by name, and local ones by absolute path:

next.config.ts
const withMDX = createMDX({
  options: {
    remarkPlugins: ["remark-frontmatter", "remark-gfm", path.join(process.cwd(), "src/lib/remark-mermaid.mjs")],
  },
});

Aliases moved from webpack.resolve.alias to turbopack.resolveAlias. SVG-as-component goes through @svgr/webpack as a Turbopack rule, the same way the CSS loader does.

What doesn't map: custom webpack plugins. Turbopack runs webpack loaders but not webpack plugins. We had one that injected build metadata into a JSON file. It became a ten-line script that runs before next build.

The escape hatch

If something breaks and you need to ship today:

next build --webpack

Webpack is still in the box. I used it once, for two days, while a loader issue got fixed upstream. Know it exists; don't make it your plan.

One trap: the project root

Turbopack infers the project root by looking for lockfiles. On my machine, a stray package.json and lockfile in my home directory made it pick the wrong root and resolve modules from there. The fix is one line:

next.config.ts
const nextConfig = {
  turbopack: { root: __dirname },
};

If Turbopack warns about multiple lockfiles, pin the root instead of ignoring the warning.

Worth it?

Yes, and there's no real choice going forward. The migration cost was a few hours per project, almost all of it translating loaders. What I got back is a dev server I stopped noticing, which is the best thing a dev server can be.