Skip to main content
Turbopack is an incremental, Rust-based bundler built into Next.js. It is the default bundler starting in Next.js 16 and is used for both next dev and next build.
To use Webpack instead of Turbopack, pass the --webpack flag to next dev or next build.

Supported platforms

On platforms without native bindings (e.g. FreeBSD), Next.js falls back to WebAssembly bindings. WASM does not support Turbopack—use the --webpack flag on those platforms.

Enabling Turbopack

Turbopack is enabled by default. No configuration is needed:
package.json
To force Webpack:
package.json

Configuration

Turbopack is configured under the turbopack key in next.config.js:
next.config.js

Resolve aliases

Map module names to different packages, similar to resolve.alias in webpack:
object
A map of module name strings to their replacement module paths.
next.config.js

Resolve extensions

Change or extend the file extensions Turbopack resolves:
string[]
Ordered list of file extensions to try when resolving imports without an extension.
next.config.js

Webpack loaders

Turbopack supports a subset of webpack loader semantics for transforming files:
object
A map of glob patterns to loader configurations.
next.config.js
Each rule value accepts:
string[] | object[]
Loader paths or { loader, options } objects to apply in order.
string
Rename the output file extension (e.g. '*.js' to treat loader output as JavaScript).

Root directory

string
The filesystem root used for module resolution. Defaults to the project directory. Set this when using symlinked packages outside the project root (e.g. npm link).
next.config.js

Experimental options

The following options are available under experimental in next.config.js:
next.config.js

Known differences from webpack

Filesystem root

Turbopack resolves modules relative to the project root. Files and symlinks outside the root are not resolved by default. Use turbopack.root to extend the resolution boundary.

CSS module ordering

Turbopack orders CSS modules according to JavaScript import order. Webpack sometimes ignores this order for side-effect-free modules, which can cause subtle differences. To enforce CSS order, use @import in CSS modules:
button.module.css

Sass ~ imports

Webpack supports tilde (~) prefixes for Sass node_modules imports. Turbopack does not. Replace:
Or configure an alias:
next.config.js

Webpack plugins

Turbopack does not support webpack plugins. Webpack loaders are supported via the turbopack.rules configuration.

Performance tracing

To generate a trace file for performance debugging:
This creates a .next/dev/trace-turbopack file. Include it when reporting issues on the Next.js GitHub repository.

Version history