nextjs - ✅(Solved) Fix Single sourcemap always emitted regardless of sourcemap config [1 pull requests, 6 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#89894Fetched 2026-04-08 00:21:08
View on GitHub
Comments
6
Participants
3
Timeline
15
Reactions
0
Author
Timeline (top)
commented ×6mentioned ×2subscribed ×2closed ×1

Fix Action

Fixed

PR fix notes

PR #89915: Next-api: Check client_source_maps before generate source map

Description (problem / solution / changelog)

What?

Fixes #89894. See original issue for detailed information.

This check should avoid generating unexpected source map.

Why?

Please see #89894 -- an source map was unexpectedly generated from with productionBrowserSourceMaps set to false.

How?

Added an extra check to next-api crate. Now client_assets.insert(ResolvedVc::upcast(polyfill_source_map_asset)); will only be executed if *client_source_maps != SourceMapsType::None. It seems that it fixed the issue on my computer, but further verifications are required (help wanted).

Additional information

I am not sure if tests are required for this check. Help wanted (if tests are necessary).

Changed files

  • crates/next-api/src/app.rs (modified, +14/-8)

Code Example

"sources":["turbopack:///node_modules/next/dist/build/polyfills/polyfill-nomodule.js"]

---

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Debian 6.12.69-1 (2026-02-08)
  Available memory (MB): 27761
  Available CPU cores: 16
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 10.29.3
Relevant Packages:
  next: 16.2.0-canary.37 // Latest available version is detected (16.2.0-canary.37).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/DuckThom/sourcemap-reproduction-app

To Reproduce

  1. Clone the repo and install dependencies npm i
  2. Create a production build npm run build
  3. Run find .next/static -name "*.map" => .next/static/chunks/a6dad97d9634a72d.js.map is always created

Current vs. Expected behavior

Since productionBrowserSourceMaps is not enabled in the Next config, I expect there to not be any browser accessible sourcemaps. Yet regardless of this setting, .next/static/chunks/a6dad97d9634a72d.js.map is always emitted and thus accessible in the browser. It appears to be the sourcemap for the following file:

"sources":["turbopack:///node_modules/next/dist/build/polyfills/polyfill-nomodule.js"]

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Debian 6.12.69-1 (2026-02-08)
  Available memory (MB): 27761
  Available CPU cores: 16
Binaries:
  Node: 20.19.5
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 10.29.3
Relevant Packages:
  next: 16.2.0-canary.37 // Latest available version is detected (16.2.0-canary.37).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

extent analysis

Fix: Disable production source‑map generation (work‑around for the polyfill‑nomodule map)

Next 16’s Turbopack still emits a `.map

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING