Skip to content

[nextjs] Extend default sourcemaps ignore (#18938) to client-side stub chunks that never emit sourcemaps #22199

Description

@sakuga-cmd

Problem Statement

@sentry/nextjs 10.43.0 with a Next.js 15.5.14 (webpack) App Router project: the client-side source map upload prints dozens of warnings for chunks that by construction never emit sourcemaps:

~/b0f41f6b-e36f-409b-817f-921f7d295a7b-155.js (no sourcemap found, debug id b0f41f6b-...)
  - warning: could not determine a source map reference (Could not auto-detect referenced sourcemap for ~/b0f41f6b-...-155.js)

In our production builds these were ~95 warnings per deploy. We traced every one of them to two categories of client chunks:

  1. App Router client stubsstatic/chunks/app/**/route-<hash>.js (one per API route / metadata route), loading-<hash>.js, _not-found/page-<hash>.js, and page-<hash>.js stubs of fully server-rendered pages. Each is ~600–980 bytes: the Sentry debug-id snippet plus a single empty webpack module ({84441:()=>{}}). Webpack emits no .map for them.
  2. Tiny lazy plugin chunks — numbered chunks of ~600 bytes (in our case Capacitor web plugin stubs like SplashScreenWeb, HapticsWeb registered via registerPlugin(..., { web: () => import(...) })). Also emitted without .map.

PR #18938 (released in 10.37.0, closing #18872) already solved exactly this class of noise for framework internals/manifests, with the rationale “these will never emit sourcemaps and we just waste time processing these files”. The client-side stubs above are the same situation, but they are not covered by the default ignore list.

User-side workaround status: sourcemaps.ignore globs work for the named stubs (**/static/chunks/app/**/route-*.js, loading-*.js, _not-found/** — this removed ~89 of ~95 warnings for us, merging with the defaults as expected). However the numbered lazy chunks cannot be targeted by any stable glob — their names are content-hashed numerics that change between builds, so a handful of warnings per deploy remain unfixable from userland.

Solution Brainstorm

  • Extend the default ignore list approach of feat(nextjs): Update default ignore list for sourcemaps #18938 to App Router client stubs (static/chunks/app/**/route-*.js, loading-*.js, _not-found/**), and/or
  • More generally: skip the “could not determine a source map reference” warning for chunks for which webpack emitted no sourcemap and that contain no module code beyond the injected debug-id snippet — those can never benefit from an artifact upload anyway.

Environment: @sentry/nextjs 10.43.0, @sentry/webpack-plugin 5.2.0, Next.js 15.5.14 (webpack build, not Turbopack), widenClientFileUpload: true, deployed on Vercel.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugjavascriptPull requests that update javascript code

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions