Sourcemaps broken for next/dist files in Yarn PnP mode (webpack)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
https://github.com/WooWan/yarn-pnp-sourcemap-repro/tree/main
To Reproduce
- Start the application in development (yarn dev)
- Open Chrome DevTools → Sources tab
- Look for
next/dist/client/components/app-router.js - Instead of seeing original
.tssource files, the bundled.jsfiles are shown
Current vs. Expected behavior
Current: In Yarn PnP mode, DevTools shows .js files instead of original .ts sources for Next.js internal runti
+me files (next/dist/client/, next/dist/shared/lib/, next/dist/pages/). inputSourceMap is not passed to the SWC
+ loader, so source map chaining is broken.
Expected: DevTools should show .ts source files, same as non-PnP mode.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:53:15 PST 2026; root:xnu-12377.81.4~5/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 24.6.0
npm: 11.5.1
Yarn: 4.12.0
pnpm: N/A
Relevant Packages:
next: 16.1.6
eslint-config-next: N/A
react: 19.2.3
react-dom: 19.2.3
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Webpack, SWC
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
This issue originated from https://github.com/vercel/next.js/pull/33236.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked yarn-pnp-sourcemap-repro repository and reproduce the problem with yarn dev, then inspect next/dist/client/components/app-router.js in Chrome DevTools. Trace the Webpack/SWC source-map handling for Next.js internal runtime files and verify that done means DevTools shows the original .ts sources in Yarn PnP mode, matching non-PnP behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, typescript
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100