Skip to content

Sourcemaps broken for next/dist files in Yarn PnP mode (webpack) #90129

@WooWan

Description

@WooWan

Link to the code that reproduces this issue

https://github.com/WooWan/yarn-pnp-sourcemap-repro/tree/main

To Reproduce

  1. Start the application in development (yarn dev)
  2. Open Chrome DevTools → Sources tab
  3. Look for next/dist/client/components/app-router.js
  4. Instead of seeing original .ts source files, the bundled .js files 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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    SWCRelated to minification/transpilation in Next.js.WebpackRelated to Webpack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions