nextjs - 💡(How to fix) Fix Add option to hide sourcemaps for client side bundle [8 comments, 4 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#84095Fetched 2026-04-08 02:20:37
View on GitHub
Comments
8
Participants
4
Timeline
15
Reactions
3
Author
Timeline (top)
commented ×8subscribed ×4labeled ×2issue_type_added ×1

Error Message

We use https://nextjs.org/docs/app/api-reference/config/next-config-js/productionBrowserSourceMaps but wont share sources for real users. That's why we don't upload sourcemaps to s3 and just upload them to error tracking system. But it triggers alerts on 404 from our s3.

Fix Action

Fix / Workaround

[!Note] My report is about webpack specifically. Though, while there might be specific webpack config workarounds, ideally I would prefer an option in next config, that would pass the source-map intention to other bundlers such as Turbopack or Rspack.

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.6.0-canary.21 // Latest available version is detected (15.6.0-canary.21).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.3.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template

To Reproduce

npm build

Current vs. Expected behavior

Current:

We use https://nextjs.org/docs/app/api-reference/config/next-config-js/productionBrowserSourceMaps but wont share sources for real users. That's why we don't upload sourcemaps to s3 and just upload them to error tracking system. But it triggers alerts on 404 from our s3.

Expected:

when you enable sourcemaps in nextjs under the hood it sets devtool to source-map - https://github.com/vercel/next.js/blob/9cf9183e0090e0dd322f4604a21f00f00111db4c/packages/next/src/build/webpack/config/blocks/base.ts#L50

Need to have an option to use hidden-source-map for client build - https://webpack.js.org/configuration/devtool/#production. It will solve issue

[!Note] My report is about webpack specifically. Though, while there might be specific webpack config workarounds, ideally I would prefer an option in next config, that would pass the source-map intention to other bundlers such as Turbopack or Rspack.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.6.0-canary.21 // Latest available version is detected (15.6.0-canary.21).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

Webpack

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

next build (local)

Additional context

No response

extent analysis

TL;DR

Enable the hidden-source-map option for the client build in Next.js to prevent uploading sourcemaps to S3 and triggering 404 alerts.

Guidance

  • Investigate adding a custom Webpack configuration to Next.js to use hidden-source-map for the client build, as currently, Next.js sets devtool to source-map by default.
  • Review the Webpack documentation for devtool options, specifically hidden-source-map, to understand its implications and usage.
  • Consider opening a feature request in the Next.js repository to add an option to the next.config.js file to pass the source-map intention to other bundlers like Turbopack or Rspack.
  • Verify that the hidden-source-map option does not affect error tracking and debugging capabilities.

Example

No code example is provided as the issue requires a configuration change or a feature request rather than a code modification.

Notes

The solution may require a custom Webpack configuration, which could add complexity to the build process. Additionally, the hidden-source-map option might have implications for debugging and error tracking.

Recommendation

Apply a workaround by adding a custom Webpack configuration to use hidden-source-map for the client build, as this is the most direct way to address the issue with the current version of Next.js.

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