Skip to content

test(bundler-plugins): Add integration tests for sourcemaps.assets and sourcemaps.ignore - #25916

Merged
timfish merged 1 commit into
developfrom
feat/bundler-plugin-integration-tests-assets-ignore
Nov 10, 2026
Merged

timfish merged 1 commit into
developfrom
feat/bundler-plugin-integration-tests-assets-ignore

Conversation

@timfish

@timfish timfish commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

The bundler plugin integration tests had no fixture that set sourcemaps.assets or sourcemaps.ignore, and the unit tests only check that the globs reach the glob call. Nothing asserted which chunks end up uploaded, which let a gap in the staged upload work go unnoticed.

Each of the Rollup, Rolldown, Vite, webpack and esbuild fixtures gets a two-entry build with source maps on. One test ignores entry2.js, the other restricts assets to entry1.js. The sentry CLI stub can now record the sources of every map in the upload directory, opt-in through SENTRY_TEST_RECORD_UPLOADED_SOURCES, so the snapshots show which chunks were uploaded and that every map stays in the output.

These stacked PRs will need their own tests to cover the staged upload route.

…and `sourcemaps.ignore`

The bundler plugin integration tests had no fixture that set either
option, and the unit tests only check that the globs reach the glob
call. Nothing asserted which chunks end up uploaded.

Each of the Rollup, Rolldown, Vite, webpack and esbuild fixtures gets a
two-entry build with source maps on. One test ignores `entry2.js`, the
other restricts `assets` to `entry1.js`. The `sentry` CLI stub can now
record the `sources` of every map in the upload directory, opt-in
through `SENTRY_TEST_RECORD_UPLOADED_SOURCES`, so the snapshots show
which chunks were uploaded and that every map stays in the output.
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 7061d1d (PR test merge using develop at 30cfb4c)

Against: 30cfb4c (develop) · base run #64245

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.39 kB - -
@sentry/browser - with treeshaking flags 28.53 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.42 kB - -
@sentry/browser (incl. Tracing) 52.71 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.72 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.69 kB - -
@sentry/browser (incl. Tracing, Replay) 93.01 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.61 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.76 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.75 kB - -
@sentry/browser (incl. Feedback) 47.97 kB - -
@sentry/browser (incl. sendFeedback) 35.49 kB - -
@sentry/browser (incl. FeedbackAsync) 40.6 kB - -
@sentry/browser (incl. Metrics) 31.42 kB - -
@sentry/browser (incl. Logs) 31.72 kB - -
@sentry/browser (incl. Metrics & Logs) 32.44 kB - -
@sentry/react 32.27 kB - -
@sentry/react (incl. Tracing) 55.07 kB - -
@sentry/vue 38.66 kB - -
@sentry/vue (incl. Tracing) 55.73 kB - -
@sentry/svelte 30.42 kB - -
@sentry/remix (Remix 3 client bundle) 57.8 kB - -
CDN Bundle 32.18 kB - -
CDN Bundle (incl. Tracing) 53.23 kB - -
CDN Bundle (incl. Logs, Metrics) 34.45 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.18 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.86 kB - -
CDN Bundle (incl. Tracing, Replay) 91.44 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.38 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.56 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.55 kB - -
CDN Bundle - uncompressed 94.62 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.6 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.09 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.33 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.65 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 279.29 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.01 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.99 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 298.7 kB - -
@sentry/nextjs (client) 57.89 kB - -
@sentry/sveltekit (client) 53.22 kB - -
@sentry/core/server 44.24 kB - -
@sentry/core/browser 13.93 kB - -
@sentry/node 154.92 kB +0.02% +16 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.95 kB - -
@sentry/node - without tracing 96.14 kB +0.03% +23 B 🔺
@sentry/node - without channel injection 135.33 kB +0.02% +15 B 🔺
@sentry/aws-serverless 104.32 kB +0.03% +23 B 🔺
@sentry/cloudflare (withSentry) - minified 197.92 kB - -
@sentry/cloudflare (withSentry) 491.93 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 218.35 kB - -

View base workflow run

@timfish
timfish marked this pull request as ready for review October 29, 2026 19:17
@timfish
timfish requested review from a team as code owners October 29, 2026 19:17
@timfish
timfish requested review from andreiborza, chargome, isaacs, logaretm, msonnb and nicohrubec and removed request for a team and msonnb October 29, 2026 19:17

@isaacs isaacs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment, going to pivot and review the stack first. Re-requesting from myself so that it stays on my queue 👍

output: {
dir: "out/sourcemaps-ignore",
chunkFileNames: "[name].js",
sourcemap: true,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to raise that the fixtures never take the staged upload path, but I think that's covered by your stack? If this PR is meant only as a baseline before the stack, then we should maybe say that in the description, and make sure each stack PR adds the staged variant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to raise that the fixtures never take the staged upload path, but I think that's covered by your stack?

The staged upload path will be covered in the stack but I haven't got that far yet. I've added a ref. to this in the description.

I think eventually It would be good to move Roll{up,down}, Vite and webpack to only use the staged path, but that's a behavioural change because we would stop picking up maps that weren't in the build. I would say that's desirable, but it is a change. It looks like esbuild, Turbopack, SvelteKit and Nuxt will not be able to go this route though 🤔

@isaacs
isaacs self-requested a review October 29, 2026 19:55
timfish added a commit that referenced this pull request Nov 6, 2026
…r upload in the Rollup plugin (#25645)

Part of the stack for #25609. When the Rollup
or Rolldown output has no `sourcemap` setting and an upload can run, the
plugin switches the output to hidden source maps, copies each chunk and
its map into the upload staging folder from a `generateBundle` hook that
runs last, and drops the map asset so it is never written. A map the
plugin turned on never reaches the output, not even for chunks that
`sourcemaps.assets` or `sourcemaps.ignore` keep out of the upload or
that the plugin cannot prepare. `deleteSourcemapsAfterUpload: true` also
removes maps the user enabled, but only for chunks that were uploaded;
the rest stay, with a warning for a chunk the plugin cannot prepare.
`generate()` drops the maps the plugin turned on, so callers that write
the result themselves get what they configured.

Decisions and stagings are recorded per output, told apart by `format`,
`entryFileNames`, `chunkFileNames` and `file`, because several outputs
can write into one directory at once with different settings. Staging
applies `sourcemaps.assets` and `sourcemaps.ignore` through the matcher
that `glob` exports for its own `ignore` option, with the same dot-file
rules as the upload from disk: `assets` skips dot files and folders
unless a pattern names them, and `ignore` matches them.

SvelteKit and Nuxt pass `deleteSourcemapsAfterUpload: false` because
they need the map files on disk after the Vite build; the other
framework SDKs set the bundler's source map option themselves, which the
plugin never deletes, so their builds do not change until each one
migrates in its own PR. Integration fixtures cover `ignore` and `assets`
on the staged path and mixed outputs into one directory; the CLI stub
change comes from #25916 and drops out when that merges.
@timfish
timfish merged commit 726e947 into develop Nov 10, 2026
47 checks passed
@timfish
timfish deleted the feat/bundler-plugin-integration-tests-assets-ignore branch November 10, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants