-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Description
Link to the code that reproduces this issue
https://github.com/AndreiBalan-dev/nextjs-webpack-issue-repro/
To Reproduce
-
Clone the reproduction repository:
git clone https://github.com/AndreiBalan-dev/nextjs-webpack-issue-repro.git
cd nextjs-webpack-issue-repro -
Install dependencies using npm ci:
npm ci
-
Build the project using webpack mode:
npm run build:webpack
-
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 -
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/AWhich 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