next.js
25447831 - Skip dimming when `--inspect` is used (#91271)

Commit
137 days ago
Skip dimming when `--inspect` is used (#91271) When the Node.js inspector is active (e.g. via `next dev --inspect`), dimming wraps console arguments in a format string which defeats inspector affordances such as collapsible objects and clickable/linkified stack traces. This adds an early return in `convertToDimmedArgs` that skips dimming entirely when `inspector.url()` is defined. Terminal output without `--inspect` is unchanged. Ideally we would only skip dimming when a debugger frontend is actually attached, but Node.js does not expose a synchronous API for that — detecting it would require async polling of the `/json/list` HTTP endpoint. Test plan: - Unit tests in `console-dim.external.test.ts` - Manual: dimming almost never triggers now since we switched to in-band validation (no separate render pass). To reproduce manually, use a client component that calls `console.error(new Error(...))` during SSR, e.g.: 1. `__NEXT_CACHE_COMPONENTS=true pnpm next dev test/e2e/app-dir/server-source-maps/fixtures/default --inspect` 2. Open `http://localhost:3000/` in Chrome 3. Click the Node.js DevTools button 4. Load `http://localhost:3000/ssr-error-log` 5. Verify the first error in DevTools has source-mapped, expandable stack frames Before: <img width="1496" height="848" alt="before" src="https://github.com/user-attachments/assets/8b4358e1-06ec-4078-b6cc-269986e295e7" /> After: <img width="1496" height="842" alt="after" src="https://github.com/user-attachments/assets/42f33c6f-f025-410f-b44c-2ccd88fe0cfe" />
Author
Parents
Loading