Next.js runtime-debug
install
source · Clone the upstream repo
git clone https://github.com/vercel/next.js
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/vercel/next.js "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.agents/skills/runtime-debug" ~/.claude/skills/vercel-next-js-runtime-debug && rm -rf "$T"
manifest:
.agents/skills/runtime-debug/SKILL.mdsource content
Runtime Debug
Use this skill when reproducing runtime-bundle, module-resolution, or user-bundle inclusion regressions.
Local Repro Discipline
- Mirror CI env vars when reproducing CI failures.
- Key variables:
forces webpack (turbopack is default),IS_WEBPACK_TEST=1
skips packing next.js.NEXT_SKIP_ISOLATE=1 - For module-resolution validation, always rerun without
.NEXT_SKIP_ISOLATE=1
Stack Trace Visibility
Set
__NEXT_SHOW_IGNORE_LISTED=true to disable the ignore-list filtering in dev server error output. By default, Next.js collapses internal frames to at ignore-listed frames, which hides useful context when debugging framework internals. Defined in packages/next/src/server/patch-error-inspect.ts.
User-Bundle Regression Guardrail
When user
next build starts bundling internal Node-only helpers unexpectedly:
- Inspect route trace artifacts (
)..next/server/.../page.js.nft.json - Inspect traced server chunks for forbidden internals (e.g.
,next/dist/server/stream-utils/node-stream-helpers.js
).node:stream/promises - Add a
assertion that reads the route trace and traced server chunks, and fails on forbidden internals. This validates user-project bundling (not publish-time runtime bundling).test-start-webpack
Bundle Tracing / Inclusion Proof
To prove what user bundling includes, emit webpack stats from the app's
next.config.js:
// next.config.js module.exports = { webpack(config) { config.profile = true return config }, }
Then use
stats.toJson({ modules: true, chunks: true, reasons: true }) and diff webpack-stats-server.json between modes. This gives concrete inclusion reasons (e.g. which module required node:stream/promises) and is more reliable than analyzer HTML alone.
Related Skills
- flag wiring (config/schema/define-env/runtime env)$flags
- DCE-safe require patterns and edge constraints$dce-edge
- entry-base boundaries and vendored React$react-vendoring