Skip to content

fix(sourcemaps): Do not expose source maps in Vite and webpack builds - #1402

Draft
msonnb wants to merge 3 commits into
masterfrom
ms/sourcemaps-keep-source-maps-private
Draft

msonnb wants to merge 3 commits into
masterfrom
ms/sourcemaps-keep-source-maps-private

Conversation

@msonnb

@msonnb msonnb commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

The source maps wizard set build.sourcemap: true (Vite) or devtool: "source-map" (webpack). The Sentry plugin treats an explicit setting as the user's choice, so it uploaded the source maps but left them in the build output with a sourceMappingURL comment. Deploying that output publishes the original source code.

The wizard now leaves the setting unset. The plugin then generates hidden source maps, uploads them and keeps them out of the build output. Since #1382, the wizard installs a plugin version with this behavior (11.12 or later).

  • If source maps are disabled (Vite sourcemap: false, webpack devtool: false or a value like "eval"), the wizard asks before removing the setting and warns if the user keeps it. devtool: false together with SourceMapDevToolPlugin is left alone.
  • All other explicit values are kept. Before, conditional values and values like nosources-source-map were replaced.
  • The copy-paste snippets and new config files no longer set the option either.

Removing the setting gives the same result as the issue's suggestion (hidden source maps plus a deletion option), without writing deleteSourcemapsAfterUpload or filesToDeleteAfterUpload, which getsentry/sentry-javascript#26908 deprecates.

Fixes #1395

msonnb and others added 2 commits November 26, 2026 12:39
The wizard set `build.sourcemap: true` or `devtool: "source-map"`. The
Sentry plugin treats an explicit setting as the user's choice and keeps
the source maps in the build output after uploading them.

Leave the setting unset instead, so the plugin generates hidden source
maps and removes them after the upload. Ask before removing a setting
that disables source maps, and keep all other explicit values.

Fixes #1395

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/sourcemaps/tools/vite.ts Resolved
Comment thread src/sourcemaps/tools/vite.ts Resolved
…wizard cannot analyze

Look up `build` and `build.sourcemap` with `getObjectProperty`, which
skips object spreads, and add the plugin if `build` is not an object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Source maps wizard leaves source maps public in Vite and webpack projects

1 participant