Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
vercel-labs avatar

Turbopack

  • 1.3k installs
  • 229 repo stars
  • Updated July 27, 2026
  • vercel-labs/vercel-plugin

turbopack is a Vercel plugin skill for Next.js Turbopack bundler configuration, HMR, and debugging guidance.

About

The turbopack skill provides expert guidance for Next.js Turbopack bundler configuration, HMR behavior, build debugging, and differences from Webpack. Metadata priority 4 positions it as a focused reference when developers tune dev server performance or troubleshoot Turbopack-specific issues in Vercel Next.js projects. Use when configuring Turbopack, optimizing HMR, or understanding Turbopack versus Webpack tradeoffs in Next.js apps.

  • Turbopack expert guidance for Next.js projects.
  • HMR optimization and build issue debugging focus.
  • Explains Turbopack versus Webpack behavioral differences.
  • Vercel plugin skill with elevated metadata priority.
  • Frontend dev tooling configuration orientation.

Turbopack by the numbers

  • 1,271 all-time installs (skills.sh)
  • Ranked #312 of 2,277 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

turbopack capabilities & compatibility

Capabilities
turbopack configuration guidance · hmr optimization patterns · build debugging for turbopack · webpack comparison explanations
Works with
vercel
Use cases
frontend · debugging · devops
From the docs

What turbopack says it does

Turbopack expert guidance. Use when configuring the Next.js bundler, optimizing HMR, debugging build issues, or understanding the Turbopack vs Webpack differences.
SKILL.md
npx skills add https://github.com/vercel-labs/vercel-plugin --skill turbopack

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.3k
repo stars229
Security audit3 / 3 scanners passed
Last updatedJuly 27, 2026
Repositoryvercel-labs/vercel-plugin

How do I configure Turbopack, fix HMR issues, or understand differences from Webpack in Next.js?

Configure Turbopack for Next.js bundling, HMR optimization, and debugging versus Webpack differences.

Who is it for?

Next.js developers tuning Turbopack dev performance or debugging bundler issues.

Skip if: Skip for production deployment-only tasks without Turbopack or bundler configuration needs.

When should I use this skill?

User configures Turbopack, debugs Next.js HMR, or compares Turbopack vs Webpack.

What you get

Turbopack configuration and troubleshooting guidance aligned to the Next.js dev/build issue.

  • Turbopack configuration
  • HMR fix steps
  • Migration notes

By the numbers

  • Metadata priority level 4 in vercel-labs/vercel-plugin
  • References 2 official doc sources: turbo.build/pack and Next.js Turbopack docs

Files

SKILL.mdMarkdownGitHub ↗

Turbopack

You are an expert in Turbopack — the Rust-powered JavaScript/TypeScript bundler built by Vercel. It is the default bundler in Next.js 16.

Key Features

  • Instant HMR: Hot Module Replacement that doesn't degrade with app size
  • File System Caching (Stable): Dev server artifacts cached on disk between restarts — up to 14x faster startup on large projects. Enabled by default in Next.js 16.1+, no config needed. Build caching planned next.
  • Multi-environment builds: Browser, Server, Edge, SSR, React Server Components
  • Native RSC support: Built for React Server Components from the ground up
  • TypeScript, JSX, CSS, CSS Modules, WebAssembly: Out of the box
  • Rust-powered: Incremental computation engine for maximum performance

Configuration (Next.js 16)

In Next.js 16, Turbopack config is top-level (moved from experimental.turbopack):

// next.config.ts
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
  turbopack: {
    // Resolve aliases (like webpack resolve.alias)
    resolveAlias: {
      'old-package': 'new-package',
    },
    // Custom file extensions to resolve
    resolveExtensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
  },
}

export default nextConfig

CSS and CSS Modules Handling

Turbopack handles CSS natively without additional configuration.

Global CSS

Import global CSS in your root layout:

// app/layout.tsx
import './globals.css'

CSS Modules

CSS Modules work out of the box with .module.css files:

// components/Button.tsx
import styles from './Button.module.css'

export function Button({ children }) {
  return <button className={styles.primary}>{children}</button>
}

PostCSS

Turbopack reads your postcss.config.js automatically. Tailwind CSS v4 works with zero config:

// postcss.config.js
module.exports = {
  plugins: {
    '@tailwindcss/postcss': {},
    autoprefixer: {},
  },
}

Sass / SCSS

Install sass and import .scss files directly — Turbopack compiles them natively:

npm install sass
import styles from './Component.module.scss'

Common CSS pitfalls

  • CSS ordering differs from webpack: Turbopack may load CSS chunks in a different order. Avoid relying on source-order specificity across files — use more specific selectors or CSS Modules.
  • `@import` in global CSS: Use standard CSS @import — Turbopack resolves them, but circular imports cause build failures.
  • CSS-in-JS libraries: styled-components and emotion work but require their SWC plugins configured under compiler in next.config.

Tree Shaking

Turbopack performs tree shaking at the module level in production builds. Key behaviors:

  • ES module exports: Only used exports are included — write export on each function/constant rather than barrel export *
  • Side-effect-free packages: Mark packages as side-effect-free in package.json to enable aggressive tree shaking:
{
  "name": "my-ui-lib",
  "sideEffects": false
}
  • Barrel file optimization: Turbopack can skip unused re-exports from barrel files (index.ts) when the package declares "sideEffects": false
  • Dynamic imports: import() expressions create async chunk boundaries — Turbopack splits these into separate chunks automatically

Diagnosing large bundles

Built-in analyzer (Next.js 16.1+, experimental): Works natively with Turbopack. Offers route-specific filtering, import tracing, and RSC boundary analysis:

// next.config.ts
const nextConfig: NextConfig = {
  experimental: {
    bundleAnalyzer: true,
  },
}

Legacy `@next/bundle-analyzer`: Still works as a fallback:

ANALYZE=true next build
// next.config.ts
import withBundleAnalyzer from '@next/bundle-analyzer'

const nextConfig = withBundleAnalyzer({
  enabled: process.env.ANALYZE === 'true',
})({
  // your config
})

Custom Loader Migration from Webpack

Turbopack does not support webpack loaders directly. Here is how to migrate common patterns:

Webpack LoaderTurbopack Equivalent
css-loader + style-loaderBuilt-in CSS support — remove loaders
sass-loaderBuilt-in — install sass package
postcss-loaderBuilt-in — reads postcss.config.js
file-loader / url-loaderBuilt-in static asset handling
svgr / @svgr/webpackUse @svgr/webpack via turbopack.rules
raw-loaderUse import x from './file?raw'
graphql-tag/loaderUse a build-time codegen step instead
worker-loaderUse native new Worker(new URL(...)) syntax

Configuring custom rules (loader replacement)

For loaders that have no built-in equivalent, use turbopack.rules:

// next.config.ts
const nextConfig: NextConfig = {
  turbopack: {
    rules: {
      '*.svg': {
        loaders: ['@svgr/webpack'],
        as: '*.js',
      },
    },
  },
}

When migration isn't possible

If a webpack loader has no Turbopack equivalent and no workaround, fall back to webpack:

const nextConfig: NextConfig = {
  bundler: 'webpack',
}

File an issue at github.com/vercel/next.js — the Turbopack team tracks loader parity requests.

Production Build Diagnostics

Build failing with Turbopack

1. Check for unsupported config: Remove any webpack() function from next.config — it's ignored by Turbopack and may mask the real config 2. Verify `turbopack.rules`: Ensure custom rules reference valid loaders that are installed 3. Check for Node.js built-in usage in edge/client: Turbopack enforces environment boundaries — fs, path, etc. cannot be imported in client or edge bundles 4. Module not found errors: Ensure turbopack.resolveAlias covers any custom resolution that was previously in webpack config

Build output too large

  • Audit "use client" directives — each client component boundary creates a new chunk
  • Check for accidentally bundled server-only packages in client components
  • Use server-only package to enforce server/client boundaries at import time:
npm install server-only
// lib/db.ts
import 'server-only' // Build fails if imported in a client component

Comparing webpack vs Turbopack output

Run both bundlers and compare:

# Turbopack build (default in Next.js 16)
next build

# Webpack build
BUNDLER=webpack next build

Compare .next/ output sizes and page-level chunks.

Performance Profiling

HMR profiling

Enable verbose HMR timing in development:

NEXT_TURBOPACK_TRACING=1 next dev

This writes a trace.json to the project root — open it in chrome://tracing or Perfetto to see module-level timing.

Build profiling

Profile production builds:

NEXT_TURBOPACK_TRACING=1 next build

Look for:

  • Long-running transforms: Indicates a slow SWC plugin or heavy PostCSS config
  • Large module graphs: Reduce barrel file re-exports
  • Cache misses: If incremental builds aren't hitting cache, check for files that change every build (e.g., generated timestamps)

Memory usage

Turbopack's Rust core manages its own memory. If builds OOM:

  • Increase Node.js heap: NODE_OPTIONS='--max-old-space-size=8192' next build
  • Reduce concurrent tasks if running inside Turborepo: turbo build --concurrency=2

Turbopack vs Webpack

FeatureTurbopackWebpack
LanguageRustJavaScript
HMR speedConstant (O(1))Degrades with app size
RSC supportNativePlugin-based
Cold startFastSlower
EcosystemGrowingMassive (loaders, plugins)
Status in Next.js 16DefaultStill supported
Tree shakingModule-levelModule-level
CSS handlingBuilt-inRequires loaders
Production buildsSupportedSupported

When You Might Need Webpack

  • Custom webpack loaders with no Turbopack equivalent
  • Complex webpack plugin configurations (e.g., ModuleFederationPlugin)
  • Specific webpack features not yet in Turbopack (e.g., custom externals functions)

To use webpack instead:

// next.config.ts
const nextConfig: NextConfig = {
  bundler: 'webpack', // Opt out of Turbopack
}

Development vs Production

  • Development: Turbopack provides instant HMR and fast refresh
  • Production: Turbopack handles the production build (replaces webpack in Next.js 16)

Common Issues

1. Missing loader equivalent: Some webpack loaders don't have Turbopack equivalents yet. Check Turbopack docs for supported transformations. 2. Config migration: Move experimental.turbopack to top-level turbopack in next.config. 3. Custom aliases: Use turbopack.resolveAlias instead of webpack.resolve.alias. 4. CSS ordering changes: Test visual regressions when migrating — CSS chunk order may differ. 5. Environment boundary errors: Server-only modules imported in client components fail at build time — use server-only package.

Official Documentation

Related skills

How it compares

Pick turbopack over generic Next.js skills when the issue is bundler configuration, HMR, or Webpack migration rather than routing or React patterns.

FAQ

What does the turbopack skill cover?

Next.js Turbopack configuration, HMR optimization, build debugging, and Webpack comparison guidance.

When should I use turbopack?

When working with Next.js Turbopack bundler settings, dev performance, or bundler-specific errors.

Is turbopack safe to install?

Review the Security Audits panel on this page before installing in production.

Frontend Developmentfrontenddevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.