AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Source Maps Broken For Next/Dist Files In Yarn PnP Mode (Webpack)

In Yarn PnP mode, Next.js internal runtime files under next/dist lose their original TypeScript source maps in DevTools, showing bundled .js instead. The immediate cause is that inputSourceMap is not passed to the next-swc-loader, breaking source map chaining.

highConfidence 78%Next.jsRoute HandlersServer ActionsApp RouterAffected V16.1.6

Origin Analysis

Next.js webpack config fails to apply source-map-loader to next/dist files in Yarn PnP environments, so the next-swc-loader receives no inputSourceMap argument. As a result, SWC transforms the prebuilt .js files without chaining to their original .ts sources.
1. Create a Next.js app using Yarn PnP (yarn 4.x) with next 16.1.6. 2. Run yarn dev. 3. Open Chrome DevTools → Sources tab. 4. Locate next/dist/client/components/app-router.js. 5. Observe that bundled .js is shown instead of original .ts files.

Fixing Code Block

Edge Case Audit

This hotfix bypasses source-map-loader's filtering and may load stale or malformed maps if .map files are missing or outdated. It should be replaced by a proper webpack config fix that ensures source-map-loader runs for next/dist in PnP. Rollback by reverting this change and restoring the original loader behavior.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state