Skip to content

Webpack production build includes ~840KB of dev-only Next.js Devtools modules when using certain Browserslist configs #89844

@AndreiBalan-dev

Description

@AndreiBalan-dev

Link to the code that reproduces this issue

https://github.com/AndreiBalan-dev/nextjs-webpack-issue-repro/

To Reproduce

  1. Clone the reproduction repository:

    git clone https://github.com/AndreiBalan-dev/nextjs-webpack-issue-repro.git
    cd nextjs-webpack-issue-repro

  2. Install dependencies using npm ci:

    npm ci

  3. Build the project using webpack mode:

    npm run build:webpack

  4. Check the production client bundle for dev-only strings:

    grep -o "next-devtools" .next/static/chunks/ed9f2dc4-.js | wc -l
    grep -o "dev-overlay" .next/static/chunks/ed9f2dc4-
    .js | wc -l

  5. Observe that ~840–860KB of dev-only modules are present inside the production bundle.

Current vs. Expected behavior

Current Behavior

The production webpack output includes dev-only code such as:

  • next-devtools/userspace/*
  • client/dev/*
  • client/dev-overlay/*
  • client/app-link-gc

Counts inside the affected chunk (ed9f2dc4-*.js):

  • "next-devtools": 27 occurrences
  • "dev-overlay": 29 occurrences
  • "dev-tools-indicator": 16 occurrences

Chunk size: ~840–860KB of dev-only content included in production.

Expected Behavior

These modules should never appear in a production client bundle, regardless of Browserslist,
dependency versions, or SWC/Babel transformations.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 32539
  Available CPU cores: 24
Binaries:
  Node: 22.14.0
  npm: 11.6.4
  Yarn: N/A
  pnpm: 10.28.2
Relevant Packages:
  next: 16.2.0-canary.16
  eslint-config-next: N/A
  react: 19.3.0-canary-10680271-20260126
  react-dom: 19.3.0-canary-10680271-20260126
  typescript: 5.9.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Webpack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

I haven’t bisected the entire canary history yet, but I can confirm the issue exists on both 16.2.0-canary.16 and 16.2.0-canary.35.
The minimal reproduction consistently reproduces it across all recent canary versions I tested.

I have opened a PR with more information here: #89244

Metadata

Metadata

Assignees

No one assigned

    Labels

    WebpackRelated to Webpack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions