If you upgraded to Next.js 16 and your build broke, there is a good chance the bundler is the reason, not your code. Next.js Turbopack is now the default bundler for both next dev and next build, and Webpack has moved from default to deprecated escape hatch. Most apps need no changes at all. The apps that break are the ones with a custom webpack() function in next.config — and the fix is a translation job, not a rewrite.
This guide walks through that translation: what changed in Next.js 16, how to move your Webpack config to the new turbopack key, and what to do with the pieces that have no Turbopack equivalent. It is written against Next.js 16 in October 2026, and every config claim below is checked against the official Next.js docs.
What actually changed in Next.js 16
Turbopack is Vercel’s Rust-based bundler, built as Webpack’s successor. It has been around since 2022, but its role changed across releases, and that history is exactly why so many guides are now wrong:
- Next.js 15: Turbopack was opt-in for development, behind a flag, and configured under
experimental.turboinnext.config. Webpack remained the default for production builds. - Next.js 16: Turbopack is the default bundler for
next devandnext build. There is no flag to enable. The config moved to a top-levelturbopackkey, and the oldexperimental.turbolocation is out of date. - Webpack in Next.js 16: still available, but deprecated. You opt back into it per command with
next dev --webpackornext build --webpack. Treat that as a temporary bridge while you migrate, not a permanent home — a deprecated bundler is one major release away from disappearing.
Why bother migrating at all, if --webpack works? Two reasons. First, Turbopack’s whole design is incremental: it caches work down to the function level and reuses it between runs, so rebuilds and Fast Refresh get faster as your app grows, where Webpack’s rebuild cost grows with it. Vercel claims up to 5–10x faster Fast Refresh and 2–5x faster builds for Next.js 16 — treat those as vendor numbers, not a promise for your app, but the direction is real: Turbopack wins on rebuilds, which is where developers actually spend their time. Second, every new Next.js feature is built for Turbopack first. Staying on Webpack means swimming against the framework’s current.
Step 0: Get a baseline before you touch anything
Do not start by editing config. Start by making the migration measurable and reversible:
- Commit everything. You want a clean
git statusso you can diff exactly what the migration changed — and revert it in one command if the build goes sideways. - Record your current build time. Run
npm run buildon your current setup and note the wall-clock time and the output size. Without a baseline, “it feels faster” is the only evidence you will ever have. - Check your toolchain floor. Next.js 16 needs Node.js 20.9 or later and TypeScript 5.1 or later. If you are still on Node 18, upgrade Node first — a bundler migration on an unsupported runtime mixes two failures into one debugging session.
- Inventory your custom config. Open
next.config.js(or.ts) and list every customisation: awebpack()function, any loader rules, path aliases, and anynext-*wrapper plugins. That list is your migration checklist. If the list is empty, you may already be done — run the build and skip to the verification step.
Step 1: Upgrade and run the first Turbopack build
Upgrade Next.js to 16 following the official upgrade guide (the codemod path, including the second codemod for async request APIs, is covered in our Next.js 15 to 16 upgrade guide). Then clean up the Turbopack leftovers from the 15 era:
- Remove any
--turbopackor--turboflag from yourpackage.jsonscripts. In Next.js 16 there is nothing to enable —next devalready uses Turbopack. - Delete any
experimental.turboblock from your config. It is replaced by the top-levelturbopackkey in step 2. - Delete
.nextbefore the first build. Stale build output from the Webpack era is a classic source of phantom errors that have nothing to do with your migration.
rm -rf .next
npm run build
Read the build header first. A Turbopack build identifies itself — you should see Next.js 16 with a (Turbopack) marker. If the header shows no Turbopack marker, something is still forcing Webpack: check your scripts for a --webpack flag you forgot about.
If the build fails with an error along the lines of “this build is using Turbopack, with a webpack config and no turbopack config”, that is Next.js telling you exactly what step 2 is for. Your webpack() function is being ignored, and you need to translate it.
Step 2: Translate your Webpack config for Next.js Turbopack
The official Next.js docs are blunt about the shape of the problem: Turbopack does not need loaders for its built-in functionality. CSS, modern JavaScript, TypeScript and JSX compile out of the box, so you do not need css-loader, postcss-loader, or babel-loader for the standard cases. What you do need to translate is the custom stuff. Here is the mapping that covers nearly every real-world config:
| What you had in Webpack | What you do in Turbopack |
|---|---|
Path aliases in webpack.resolve.alias |
Use paths in tsconfig.json — Turbopack respects them natively — or turbopack.resolveAlias in next.config for module swaps. |
Custom loader rules in module.rules |
Rewrite as turbopack.rules: a glob maps to loaders plus an as output type. |
| Webpack plugins | There is no plugin equivalent. Find a built-in feature, a loader-based replacement, or a dedicated package — otherwise stay on --webpack for now. |
| Custom Babel plugins | Expect work. Turbopack compiles with SWC, and a Babel config file does not switch the pipeline the way it did under Webpack. Look for SWC equivalents or keep the project on --webpack until you can drop the plugin. |
| Files outside the project root | Turbopack only resolves files inside the project root by default. Set turbopack.root to an absolute path if your layout genuinely needs it, for example in a monorepo. |
The SVG example, before and after
Importing SVGs as React components is the most common custom loader in Next.js apps, and the official docs use it as their worked example. Before, with Webpack:
// next.config.js — BEFORE (Webpack, Next.js 15 era)
module.exports = {
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
return config;
},
};
After, with Turbopack. Note the differences: the key is top-level turbopack, not experimental.turbo; the rule is a glob, not a regex; and as: '*.js' declares what the loader produces:
// next.config.js — AFTER (Turbopack, Next.js 16)
module.exports = {
turbopack: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
};
Loaders that need options use the object form instead of a bare string:
// next.config.js — loader with options
module.exports = {
turbopack: {
rules: {
'*.svg': {
loaders: [
{
loader: '@svgr/webpack',
options: {
icon: true,
},
},
],
as: '*.js',
},
},
},
};
The official docs list the loaders tested to work with Turbopack’s Webpack-loader support: babel-loader, @svgr/webpack, svg-inline-loader, yaml-loader, string-replace-loader, raw-loader, sass-loader, and graphql-tag/loader. Many others work too, but those are the confirmed ones — if your loader is not on that list, test it in isolation before assuming it works.
Three loader limits that will bite you
Turbopack’s loader support is a compatibility layer, not a full Webpack. The official docs state three limits, and each one kills a different kind of config:
- Only a core subset of the Webpack loader API is implemented. A loader that leans on exotic loader-context APIs may fail even if it looks simple. When a loader breaks, the fix is usually a different loader, not a config tweak.
- Only loaders that return JavaScript are supported. Loaders that transform stylesheets or images into non-JS output do not work through
turbopack.rules. Those cases need a built-in feature or a different approach entirely. - Loader options must be plain data. Options passed to Webpack loaders have to be plain JavaScript primitives, objects, and arrays — you cannot pass a
require()d plugin module as an option value. If your old config passed plugin instances into loader options, restructure it before migrating.
Step 3: Fix the breakages in order of likelihood
Work through this list when the first Turbopack build fails. It is ordered by how often each cause actually shows up:
1. A stale experimental.turbo block or –turbopack flag
The old config location is silently ignored, not erroring helpfully in every case. Search your repo for experimental.turbo, --turbopack, and --turbo and remove every hit.
2. A webpack() function still in next.config
When Turbopack is active, the webpack key is ignored. A build that “succeeds but behaves wrong” — missing aliases, SVGs importing as URLs instead of components — almost always means a webpack() function is still sitting in the config doing nothing. Translate it or delete it; do not leave it as documentation.
3. A Webpack plugin with no Turbopack equivalent
This is the one legitimate reason to stay on --webpack temporarily. Audit what the plugin actually did: bundle analysis, for example, has standalone tools; image handling may be covered by Next.js built-ins. If nothing replaces it, keep the --webpack flag, file the migration as a tracked task with a deadline, and revisit it each Next.js release. An undated “we’ll migrate later” is how teams end up forced-migrating under a deadline when Webpack support is finally removed.
4. Imports from outside the project root
Monorepos hit this one. Turbopack resolves modules from the project root, so a shared package imported by a path outside the root fails to resolve. Set turbopack.root to the absolute path of the real root, using path.join(__dirname, '..') style code, and re-test.
5. A corrupted cache that looks like a bundler bug
If the dev server hangs on “Compiling…” or a clean-looking project fails in ways that make no sense, delete .next and restart before blaming Turbopack. Cache corruption after a bundler switch is common enough that it should be your first check, not your last resort.
Step 4: Verify like it is production, not like it compiled
A green build is the start of verification, not the end. Turbopack and Webpack can produce different output for the same source, so check behaviour, not just exit codes:
- Compare against your baseline. Build time and output size from step 0, side by side with the Turbopack numbers. If the build got dramatically slower, something is misconfigured — Turbopack should not lose to Webpack on a warm rebuild.
- Smoke-test every route type. A static page, a server-rendered page, a route with a client component, and any page using your translated loaders (SVG components, YAML imports, GraphQL documents). The bundler touches all of them; test all of them.
- Check the client bundle in the browser. Open the app, confirm Fast Refresh works on a trivial edit, and confirm no runtime
Cannot find moduleerrors appear on routes you did not visit during testing. - Update CI the same day. If your CI scripts pass
--webpackor set Turbopack-related environment variables from the 15 era, update them with the app. A migration that works locally and fails in CI is not a migration. - Keep the escape hatch documented, not secret. If any part of the app still needs
--webpack, write down which part and why, in the repo. The next person to touch the build should not have to rediscover it.
When to stay on Webpack — honestly
There are three honest reasons to keep --webpack for now: a Webpack plugin with no replacement that your production build genuinely depends on, a custom Babel plugin pipeline you cannot yet replace with SWC equivalents, or a loader that violates one of the three limits above. In each case, the right move is a time-boxed stay: keep the flag, note the blocker, and re-evaluate on the next Next.js minor release. What is not a good reason is “Webpack worked fine and change is scary.” Webpack is deprecated in Next.js 16, and deprecated means the removal clock is already running. Migrating on your own schedule beats migrating on a release note’s schedule.
The migration itself, for most apps, is smaller than the anxiety around it: delete the old flag and config location, translate one or two loader rules into turbopack.rules, move aliases into tsconfig.json, and verify the routes. The apps that suffer are the ones that skip the baseline, leave a dead webpack() function in place, or discover their one irreplaceable plugin at deploy time. Do the inventory first, and Turbopack is a quiet upgrade — which, for a bundler, is exactly what you want.
Further Reading & References
- Next.js docs: Turbopack configuration (next.config.js) — the official
turbopackkey, rules, resolveAlias, root, and loader limits. - SitePoint: Turbopack in production with Next.js 15 — the 15-era opt-in path and the config-key history that makes older guides stale.
- Turbopack in 2026: The Complete Guide to Next.js’s Rust-Powered Bundler (dev.to) — Turbopack as the Next.js 16 default and the filesystem-caching story.
- CoderCops: Next.js 16 Migration — Turbopack and Cache Components — the Webpack deprecation and the
--webpackescape hatch in migration context. - Hashbyt: Next.js 16 — Turbopack and Caching Explained — the 16.0 change set, including the Node 20.9+ and TypeScript 5.1+ floors.
- Dharmsy: Next.js 16 Update — Common Issues and Fixes — the “webpack config and no turbopack config” error and the
--webpackfallback. - Akoskm: Next.js 16 — Turbopack Stable — Turbopack as the default in 16.4 and the system-certificate history.
- HowToShipIt: Upgrade Next.js 15 to 16 — The EOL Checklist That Won’t Break Your Build
- HowToShipIt: Next.js Middleware in 2026 — The Complete Guide (It’s Called Proxy Now)
- HowToShipIt: Next.js Caching Explained — The Four Layers and the Cache Components Way
Facts checked against the official Next.js Turbopack configuration docs and the sources above on 30 October 2026. Vendor performance claims are attributed as vendor claims, not measured benchmarks.



