Turbopack Bundler Setup for Web Project

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Turbopack Bundler Configuration for Web Project

Turbopack is a bundler by Vercel, written in Rust, developed as Webpack successor inside Next.js. As of 2025, it's stable for dev mode in Next.js 13+ and gradually gaining production build support. Direct use outside Next.js is currently limited.

Current status

Turbopack doesn't exist as a standalone tool with open configuration API — unlike Webpack, Vite, or esbuild. It's integrated into Next.js via --turbopack flag and configured via next.config.ts. This is deliberate team decision: first stabilize within one framework, then expand support.

What to expect:

  • dev mode — stable with Next.js 14+, noticeable speed gains for large codebases
  • production build — in active development, support appeared in Next.js 15 in experimental mode
  • standalone use — not publicly available yet

Enabling in Next.js

# Next.js 14+
next dev --turbopack

# Or via package.json
{
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build"  // production without flag for now
  }
}

Configuration via next.config.ts

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

const config: NextConfig = {
  experimental: {
    turbo: {
      // Custom loaders (webpack loaders equivalent)
      rules: {
        '*.svg': {
          loaders: ['@svgr/webpack'],
          as: '*.js',
        },
        '*.mdx': {
          loaders: ['@mdx-js/loader'],
          as: '*.js',
        },
      },

      // Path aliases
      resolveAlias: {
        '@components': './src/components',
        '@utils': './src/utils',
        // Module replacement (webpack resolve.alias equivalent)
        'lodash': 'lodash-es',
      },

      // File extensions in priority order
      resolveExtensions: ['.tsx', '.ts', '.jsx', '.js', '.json'],
    },
  },
};

export default config;

Webpack loaders compatibility

Turbopack supports limited set of webpack-compatible loaders. Fully compatible:

rules: {
  '*.mdx': { loaders: ['@mdx-js/loader'], as: '*.js' },
  '*.svg': { loaders: ['@svgr/webpack'], as: '*.js' },
  '*.yaml': { loaders: ['yaml-loader'], as: '*.js' },
  '*.graphql': { loaders: ['graphql-tag/loader'], as: '*.js' },
}

Don't work or work partially: most CSS-loaders (Next.js handles CSS itself), loaders with complex side-effects, loaders requiring webpack compilation hooks.

Environment variables and define

// In next.config.ts Turbopack respects standard Next.js env
// .env.local, .env.development, .env.production

// For custom define there's no direct API in Turbopack —
// use standard Next.js mechanism:
const config: NextConfig = {
  env: {
    CUSTOM_KEY: process.env.CUSTOM_KEY,
  },
};

Performance debugging

Turbopack has built-in tracing:

NEXT_TURBOPACK_TRACING=1 next dev --turbopack

Generates .next/trace file, which can be opened in Chrome DevTools Performance tab via chrome://tracing.

Useful metrics to track after enabling Turbopack:

# Time of first dev server start
time next dev --turbopack

# Time of HMR after file change — see in terminal:
# "compiled client and server successfully in Xms"

Limitations vs Webpack

Currently unavailable in Next.js with Turbopack:

  • webpack() function in next.config.ts is ignored
  • Some Babel plugins (Turbopack uses SWC)
  • next/bundle-analyzer — replacement: @next/bundle-analyzer doesn't work, use turbo-pack-analyze or built-in tracing
  • Part of community plugins that patch webpack config directly
// This won't work with --turbopack:
const config: NextConfig = {
  webpack(config) {
    config.plugins.push(new MyPlugin());  // ignored
    return config;
  },
};

Migration from webpack customizations

If project uses non-standard webpack configurations, audit before enabling Turbopack:

# Check what's used in webpack config
grep -r "webpack(" next.config.*
grep -r "new webpack\." next.config.*

For each customization, find equivalent in Turbopack API or temporarily keep webpack for production:

// Hybrid approach: Turbopack for dev, Webpack for build
{
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build"  // webpack
  }
}

Timeline

Enabling --turbopack in existing Next.js project without custom webpack loaders: 1–2 hours (including testing and compatibility verification). Migrating project with non-standard webpack configurations: 1–3 days depending on customization complexity.