diff --git a/docs/platforms/javascript/common/best-practices/micro-frontends.mdx b/docs/platforms/javascript/common/best-practices/micro-frontends.mdx
index 36a8eecc493df..0766ba74d11a4 100644
--- a/docs/platforms/javascript/common/best-practices/micro-frontends.mdx
+++ b/docs/platforms/javascript/common/best-practices/micro-frontends.mdx
@@ -83,7 +83,6 @@ below is for Webpack, but this is also supported in Vite, Rollup, and esbuild.
const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");
module.exports = {
- devtool: "hidden-source-map", // Source map generation must be turned on ("hidden-source-map", "source-map", etc.)
plugins: [
sentryWebpackPlugin({
moduleMetadata: ({ release }) => ({ dsn: "__MODULE_DSN__", release }),
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/angular-nx.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/angular-nx.mdx
index 3b190aed99d08..9836abd748b42 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/angular-nx.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/angular-nx.mdx
@@ -90,29 +90,23 @@ const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");
module.exports = {
// ... other config above ...
- devtool: "hidden-source-map", // Source map generation must be turned on ("hidden-source-map", "source-map", etc.)
plugins: [
sentryWebpackPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
+ delete: true,
+ },
}),
],
};
```
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Webpack Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
+
+Angular turns on the source maps, so the plugin keeps them in the build output by default. `sourcemaps.delete: true` removes them after the upload, so your users can't download them.
+
Learn more about configuring the plugin in our Sentry webpack plugin documentation.
@@ -147,7 +141,10 @@ Then, follow the [official Nx documentation](https://nx.dev/nx-api/angular/execu
"options": {
"org": "___ORG_SLUG___",
"project": "___PROJECT_SLUG___",
- "authToken": "___SENTRY_AUTH_TOKEN___"
+ "authToken": "___SENTRY_AUTH_TOKEN___",
+ "sourcemaps": {
+ "delete": true
+ }
}
}
]
@@ -158,11 +155,9 @@ Then, follow the [official Nx documentation](https://nx.dev/nx-api/angular/execu
```
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Esbuild Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
+
+Angular turns on the source maps, so the plugin keeps them in the build output by default. `sourcemaps.delete: true` removes them after the upload, so your users can't download them.
+
## 3. Upload
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/angular-webpack.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/angular-webpack.mdx
index 0d748d55e5439..d76e657f2cd10 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/angular-webpack.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/angular-webpack.mdx
@@ -102,18 +102,14 @@ const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");
module.exports = {
// ... other config above ...
- devtool: "hidden-source-map", // Source map generation must be turned on ("hidden-source-map", "source-map", etc.)
plugins: [
sentryWebpackPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
+ delete: true,
+ },
}),
],
};
@@ -137,9 +133,7 @@ We recommend running a production build to test your implementation.
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Webpack Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
+
+Angular turns on the source maps, so the plugin keeps them in the build output by default. `sourcemaps.delete: true` removes them after the upload, so your users can't download them.
+
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/bundler-plugin-options.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/bundler-plugin-options.mdx
index 631e695c64f60..5d8eb45194b3d 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/bundler-plugin-options.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/bundler-plugin-options.mdx
@@ -48,9 +48,6 @@ sentryVitePlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
- sourcemaps: {
- filesToDeleteAfterUpload: ["./dist/**/*.map"],
- },
});
```
@@ -157,6 +154,62 @@ Completely disables all functionality of the plugin.
Options related to source maps upload and processing.
+When your bundler's source map setting isn't set, the plugin turns on hidden source maps, uploads them, and removes them from the build output. It does this only when it can upload, that is, when it has an auth token, an organization, and a project. Source maps that you turn on yourself are uploaded and stay in the build output.
+
+
+
+Whether the plugin uploads source maps to Sentry.
+
+With `false`, the plugin uploads nothing, but it still injects debug IDs: the bundles get the debug ID snippet and a `//# debugId=` comment, and the emitted source maps get the matching `debug_id` field. This happens inside the bundler's build pipeline, so hashes computed by later build steps (for example, for subresource integrity) include the debug IDs.
+
+Use this to upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`. The files already have their debug IDs, so you don't need an `inject` step.
+
+With `false`, the plugin turns on source maps only when `sourcemaps.delete` is `false`.
+
+```javascript
+sentryVitePlugin({
+ sourcemaps: {
+ // Upload only in CI
+ upload: process.env.CI === "true",
+ },
+});
+```
+
+
+
+
+
+Whether the plugin injects debug IDs into the bundles and their source maps.
+
+With `false`, the plugin adds no debug IDs and uploads no source maps, because the upload matches files by debug ID. Use this when another tool injects the debug IDs and uploads the source maps, for example the Sentry CLI.
+
+
+
+
+
+Whether the plugin removes source maps from the build output.
+
+- Not set: the plugin removes the source maps it turned on itself, that is, when your bundler's source map setting wasn't set. Source maps that you turned on stay.
+- `true`: the plugin removes all source maps of the build, also the ones you turned on, and also the ones of files that `sourcemaps.assets` or `sourcemaps.ignore` keep out of the upload. The plugin switches visible source maps to hidden ones, so that no `sourceMappingURL` comment points to a removed file.
+- `false`: the plugin removes no source maps. When your bundler's source map setting isn't set, the plugin turns on hidden source maps, and they stay in the build output.
+
+`true` and `false` don't depend on an upload. They also apply when the upload is turned off, when it can't run (for example, without an auth token), and when it fails.
+
+With Rollup, Vite, and webpack, the plugin never writes the removed source maps to the output directory. With esbuild, it deletes them after the build.
+
+To keep the source maps for a manual upload later, set `upload: false` and `delete: false`:
+
+```javascript
+sentryVitePlugin({
+ sourcemaps: {
+ upload: false,
+ delete: false,
+ },
+});
+```
+
+
+
A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
@@ -203,25 +256,20 @@ Use the `debug` option to print information about source map resolution.
-
-
-A glob, an array of globs or a promise resolving a glob or array of globs that specifies the build artifacts that should be deleted after the artifact upload to Sentry has been completed.
-
-Note: If you pass in a Promise that resolves to a string or array, the plugin will await the Promise and use the resolved value globs. This is useful if you need to dynamically determine the files to delete. Some higher-level Sentry SDKs or options use this feature (e.g., SvelteKit).
-
-The globbing patterns must follow the implementation of the [`glob`](https://www.npmjs.com/package/glob#glob-primer) package.
+
-Use the `debug` option to print information about which files end up being deleted.
+Use [`sourcemaps.upload`](#sourcemaps.upload) and [`sourcemaps.injectDebugIds`](#sourcemaps.injectDebugIds) instead:
-
+| `sourcemaps.disable` | Replacement |
+| -------------------- | ---------------------------------- |
+| `"disable-upload"` | `sourcemaps.upload: false` |
+| `true` | `sourcemaps.injectDebugIds: false` |
-
+When you set `upload` or `injectDebugIds`, the plugin ignores `disable`.
If this flag is `true`, any functionality related to source maps will be disabled.
-If set to `"disable-upload"`, the plugin will not upload source maps to Sentry, but will still inject debug IDs into the build artifacts: the bundles receive the runtime debug ID snippet and a `//# debugId=` comment, and the emitted source maps receive the matching `debug_id` field. This happens inside the bundler's build pipeline, so hashes computed by later build steps (for example, for subresource integrity) include the debug IDs.
-
-This is useful if you want to manually upload source maps to Sentry at a later point in time, for example with `sentry-cli sourcemaps upload`. The artifacts already carry their debug IDs, so no `inject` step is needed.
+If set to `"disable-upload"`, the plugin will not upload source maps to Sentry, but will still inject debug IDs into the build artifacts, like `sourcemaps.upload: false`.
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/esbuild.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/esbuild.mdx
index b6595835f4cd4..9bc3bf18ec092 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/esbuild.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/esbuild.mdx
@@ -92,19 +92,12 @@ Example:
const { sentryEsbuildPlugin } = require("@sentry/bundler-plugins/esbuild");
require("esbuild").build({
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
plugins: [
// Put the Sentry esbuild plugin after all other plugins
sentryEsbuildPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
@@ -118,19 +111,12 @@ require("esbuild").build({
const { sentryEsbuildPlugin } = require("___SDK_PACKAGE___/esbuild");
require("esbuild").build({
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
plugins: [
// Put the Sentry esbuild plugin after all other plugins
sentryEsbuildPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
@@ -138,13 +124,7 @@ require("esbuild").build({
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Esbuild Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/rollup.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/rollup.mdx
index 06aa5f958ffef..fe72a764beb04 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/rollup.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/rollup.mdx
@@ -72,20 +72,12 @@ Example:
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
export default {
- output: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
// Put the Sentry rollup plugin after all other plugins
sentryRollupPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
};
@@ -99,20 +91,12 @@ export default {
import { sentryRollupPlugin } from "@sentry/node/rollup";
export default {
- output: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
// Put the Sentry rollup plugin after all other plugins
sentryRollupPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
};
@@ -120,10 +104,4 @@ export default {
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Rollup Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx
index f80aaf701c107..9b16eecf494a6 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx
@@ -81,21 +81,12 @@ import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/bundler-plugins/vite";
export default defineConfig({
- build: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
// Put the Sentry Vite plugin after all other plugins
sentryVitePlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
@@ -110,21 +101,12 @@ import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/node/vite";
export default defineConfig({
- build: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
// Put the Sentry Vite plugin after all other plugins
sentryVitePlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
@@ -132,13 +114,7 @@ export default defineConfig({
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Vite Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx
index 3ecc5dc434c6e..416a759ada7c3 100644
--- a/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx
+++ b/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx
@@ -22,7 +22,7 @@ If you'd rather configure source map uploading with webpack manually, follow the
## Manual Setup
-
+
Install the Sentry webpack plugin:
@@ -40,7 +40,7 @@ pnpm add @sentry/bundler-plugins --save-dev
-
+
The Sentry webpack plugin is part of your Sentry SDK package. You don't need to install another package.
@@ -75,18 +75,11 @@ const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");
module.exports = {
// ... other config above ...
- devtool: "hidden-source-map", // Source map generation must be turned on ("hidden-source-map", "source-map", etc.)
plugins: [
sentryWebpackPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
};
@@ -102,18 +95,11 @@ const { sentryWebpackPlugin } = require("___SDK_PACKAGE___/webpack");
module.exports = {
// ... other config above ...
- devtool: "hidden-source-map", // Source map generation must be turned on ("hidden-source-map", "source-map", etc.)
plugins: [
sentryWebpackPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
};
@@ -125,39 +111,36 @@ module.exports = {
-Add the following to your `gatsby-node.js` file:
+`@sentry/gatsby` adds the Sentry webpack plugin to production builds, so you don't need to add it yourself. The SDK passes no organization, project, or auth token to the plugin. Set them with the `SENTRY_ORG`, `SENTRY_PROJECT`, and `SENTRY_AUTH_TOKEN` environment variables, or in the `.env.sentry-build-plugin` file.
-```javascript {filename:gatsby-node.js}
-const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");
+
-exports.onCreateWebpackConfig = ({ actions }) => {
- actions.setWebpackConfig({
- plugins: [
- sentryWebpackPlugin({
- org: "___ORG_SLUG___",
- project: "___PROJECT_SLUG___",
- authToken: process.env.SENTRY_AUTH_TOKEN,
+Gatsby sets `devtool: "source-map"` for production builds, so the SDK uploads these source maps but keeps them in the build output by default. To remove the browser source maps after the upload, set `sourcemaps.delete` in the plugin options:
+```javascript {filename:gatsby-config.js}
+module.exports = {
+ plugins: [
+ {
+ resolve: "@sentry/gatsby",
+ options: {
sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
- }),
- ],
- });
+ delete: true,
+ },
+ },
+ },
+ ],
};
```
+
+
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using Sentry Webpack Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
-
+
+
+
+
+
diff --git a/docs/platforms/javascript/common/troubleshooting/index.mdx b/docs/platforms/javascript/common/troubleshooting/index.mdx
index 546fddfd90cd8..b0c2786dea02e 100644
--- a/docs/platforms/javascript/common/troubleshooting/index.mdx
+++ b/docs/platforms/javascript/common/troubleshooting/index.mdx
@@ -499,7 +499,7 @@ Learn more about fixing these caching issues in the
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using [Sentry Esbuild Plugin's
- `sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.filesToDeleteAfterUpload)
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/rollup.mdx b/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/rollup.mdx
index c2f8ffb6e6b6d..827faf75f50c4 100644
--- a/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/rollup.mdx
+++ b/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/rollup.mdx
@@ -60,29 +60,15 @@ Example:
import { sentryRollupPlugin } from "@sentry/bundler-plugins/rollup";
export default {
- output: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
// Put the Sentry rollup plugin after all other plugins
sentryRollupPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
};
```
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using [Sentry Rollup Plugin's
- `sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.filesToDeleteAfterUpload)
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/vite.mdx b/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/vite.mdx
index dc338d99470c8..b55e78a0ec682 100644
--- a/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/vite.mdx
+++ b/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/vite.mdx
@@ -69,33 +69,18 @@ import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/bundler-plugins/vite";
export default defineConfig({
- build: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
// Put the Sentry Vite plugin after all other plugins
sentryVitePlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
```
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using [Sentry Vite Plugin's
- `sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.filesToDeleteAfterUpload)
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/webpack.mdx b/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/webpack.mdx
index a2f2839024e8e..728d2a31ae25f 100644
--- a/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/webpack.mdx
+++ b/docs/platforms/javascript/guides/cordova/sourcemaps/uploading/webpack.mdx
@@ -61,30 +61,17 @@ const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");
module.exports = {
// ... other config above ...
- devtool: "hidden-source-map", // Source map generation must be turned on ("hidden-source-map", "source-map", etc.)
plugins: [
sentryWebpackPlugin({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
};
```
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to
- deny access to `.js.map` files, or by using [Sentry Webpack Plugin's
- `sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.filesToDeleteAfterUpload)
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/docs/platforms/javascript/guides/nextjs/capturing-errors/index.mdx b/docs/platforms/javascript/guides/nextjs/capturing-errors/index.mdx
index 22c75d1cf790c..00ccd307bfef2 100644
--- a/docs/platforms/javascript/guides/nextjs/capturing-errors/index.mdx
+++ b/docs/platforms/javascript/guides/nextjs/capturing-errors/index.mdx
@@ -202,7 +202,7 @@ If you see the same error twice, you're likely capturing in multiple places. Che
### Missing Stack Traces
-Server errors may show minified traces in production. Enable source maps for readable traces.
+Server errors may show minified traces in production when Sentry has no source maps for them. Check that your build uploads source maps.
The `digest` property on server errors is a hash you can search for in logs.
diff --git a/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx b/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx
index 26f1c59202ffa..3fe951fcdbea9 100644
--- a/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx
+++ b/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx
@@ -94,53 +94,81 @@ withSentryConfig(nextConfig, {
## Source Maps Options
-
+You don't need to turn source maps on. When you run `next build`, the SDK turns on source maps if you haven't set them, uploads them, and removes the client-side source maps from the build output. Server-side source maps stay.
-Disable any functionality related to source maps.
+- Webpack: when `devtool` isn't set, the SDK uses `hidden-source-map` for the client build and `source-map` for the server builds. It removes all client-side source maps, also the ones you turned on yourself.
+- Turbopack: when `productionBrowserSourceMaps` isn't set, the SDK sets it to `true` and removes the client-side source maps after the upload. When you set `productionBrowserSourceMaps` yourself, the client-side source maps stay.
-
+To change this, use [`sourcemaps.upload`](#sourcemaps.upload), [`sourcemaps.injectDebugIds`](#sourcemaps.injectDebugIds), and [`sourcemaps.delete`](#sourcemaps.delete).
-
+
-A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry. If not specified, the plugin will try to upload all JavaScript files and source map files created during build.
+Whether the SDK uploads source maps to Sentry.
-The globbing patterns follow the implementation of the `glob` package.
+With `false`, the SDK uploads nothing, but it still injects debug IDs into the bundles and their source maps. Use this to upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`. The files already have their debug IDs, so you don't need an `inject` step.
+
+With `false`, the SDK turns on source maps only when `sourcemaps.delete` is `false`.
-
+
-A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
+Whether the SDK injects debug IDs into the bundles and their source maps.
+
+With `false`, the SDK adds no debug IDs, uploads no source maps, and turns on no source maps, because the upload matches files by debug ID. Use this when another tool injects the debug IDs and uploads the source maps, for example the Sentry CLI.
-
+
-Toggle whether generated **client-side** source maps within your Next.js build folder will be automatically deleted after being uploaded to Sentry. When enabled, source maps in `.next/static/` are deleted but **server-side source maps** (in `.next/server/`) are intentionally kept because:
+Whether the SDK removes the **client-side** source maps (in `.next/static/`) from the build output. The SDK never removes the **server-side** source maps (in `.next/server/`), because:
- They are required for server-side error reporting at runtime.
- They are not a security concern since they are not publicly accessible to users.
-To customize which files are deleted after upload (for example, to include additional paths), use the `sourcemaps.filesToDeleteAfterUpload` option instead.
-
-
+The values:
-
+- Not set: with Webpack, the SDK removes all client-side source maps. With Turbopack, it removes them only when it turned them on itself, that is, when `productionBrowserSourceMaps` isn't set. When you turn off the upload, the SDK removes nothing.
+- `true`: the SDK removes all client-side source maps, also the ones you turned on (for example with `productionBrowserSourceMaps`) and the ones that weren't uploaded.
+- `false`: the SDK removes no source maps. When you haven't set the source map setting, the SDK still turns source maps on, and they stay in the build output. With Turbopack, these files have `sourceMappingURL` comments, so browsers can find them.
-An array of glob patterns that specifies which source map files will be deleted after being uploaded to Sentry. When set, this overrides the default deletion behavior of `deleteSourcemapsAfterUpload`.
+`true` and `false` don't depend on an upload. They also apply when you turn off the upload, and when the upload fails.
-Use this option when you need fine-grained control over which source maps are deleted. Make sure to also enable [hidden source maps](https://webpack.js.org/configuration/devtool/) for any files you plan to delete, otherwise your build output will contain broken `sourceMappingURL` references.
+To keep the source maps for a manual upload later, set `upload: false` and `delete: false`:
```javascript
withSentryConfig(nextConfig, {
sourcemaps: {
- filesToDeleteAfterUpload: [".next/static/**/*.map"],
+ upload: false,
+ delete: false,
},
});
```
+
+
+Use [`sourcemaps.upload`](#sourcemaps.upload) and [`sourcemaps.injectDebugIds`](#sourcemaps.injectDebugIds) instead. `"disable-upload"` is the same as `upload: false`, and `true` is the same as `injectDebugIds: false`. When you set `upload` or `injectDebugIds`, the SDK ignores `disable`.
+
+Disable any functionality related to source maps.
+
+
+
+
+
+A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry. If not specified, the plugin will try to upload all JavaScript files and source map files created during build.
+
+The globbing patterns follow the implementation of the `glob` package.
+
+
+
+
+
+A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
+
+
+
## Release Options
@@ -193,10 +221,12 @@ Include Next.js-internal code and code from dependencies when uploading source m
If you find that there are some frames in your client-side stack traces that
aren't getting source-mapped even when most others are, the issue might be
that those frames are from files in `static/chunks/` rather than
- `static/chunks/pages/`. By default, such files aren't uploaded because the
- majority of the files in `static/chunks/` only contain Next.js or third-party
- code. To upload all of the files and source maps, including ones from
- third-party packages, set the `widenClientFileUpload` option to `true`.
+ `static/chunks/pages/`. With Webpack, such files aren't uploaded by default
+ because the majority of the files in `static/chunks/` only contain Next.js or
+ third-party code. To upload all of the files and source maps, including ones
+ from third-party packages, set the `widenClientFileUpload` option to `true`.
+ With Turbopack, the SDK uploads `static/chunks/` by default, and this option
+ adds only the `main-*` chunks.
Note: Enabling this option can lead to longer build times.
diff --git a/docs/platforms/javascript/guides/nextjs/manual-setup/webpack-setup.mdx b/docs/platforms/javascript/guides/nextjs/manual-setup/webpack-setup.mdx
index 02e70ca785262..2df3a5d21a76f 100644
--- a/docs/platforms/javascript/guides/nextjs/manual-setup/webpack-setup.mdx
+++ b/docs/platforms/javascript/guides/nextjs/manual-setup/webpack-setup.mdx
@@ -89,6 +89,8 @@ export default withSentryConfig(nextConfig, {
By default, Webpack uploads source maps **during the build process** using the Sentry Webpack Plugin. This happens separately for each build (client, server, edge), which can increase build time.
+You don't need to turn source maps on. When `devtool` isn't set, the SDK uses `hidden-source-map` for the client build and `source-map` for the server builds. It removes all client-side source maps from the build output and keeps the server-side source maps. To change this, see [`sourcemaps.delete`](/platforms/javascript/guides/nextjs/configuration/build/#sourcemaps.delete).
+
For faster builds, you can use the post-build upload mode (available in Next.js 15.4.1+), which uploads all source maps in a single operation after all builds complete.
### Default: Upload During Build
diff --git a/docs/platforms/javascript/guides/react-router/hydrogen.mdx b/docs/platforms/javascript/guides/react-router/hydrogen.mdx
index 7c36175596822..668cdc036251e 100644
--- a/docs/platforms/javascript/guides/react-router/hydrogen.mdx
+++ b/docs/platforms/javascript/guides/react-router/hydrogen.mdx
@@ -270,6 +270,8 @@ sentry-cli sourcemaps inject /path/to/build/dir
sentry-cli sourcemaps upload /path/to/build/dir
```
+When you don't set `build.sourcemap` in your Vite config, the `sentryReactRouter` plugin turns on hidden source maps. Without the `buildEnd` hook, the SDK doesn't remove them, so delete the `.map` files from your build output after the upload.
+
### Control the Data You Send to Sentry
+When you don't set `build.sourcemap` in your Vite config, the SDK turns on hidden source maps for the client and server builds. After the adapter ran, the SDK uploads the source maps to Sentry and removes them from the build output. When you turn on source maps yourself, the SDK uploads them and they stay.
+
+
Disable automatic source maps upload by setting `autoUploadSourceMaps` to `false`.
+With `false`, the SDK also doesn't turn on source maps or inject debug IDs. To upload the source maps yourself later, set [`sourcemaps.upload`](#sourcemaps.upload) to `false` instead.
+
+
+
+
+
+Whether the SDK uploads source maps to Sentry.
+
+With `false`, the SDK uploads nothing, but it still injects debug IDs into the bundles and their source maps. Use this to upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`. The files already have their debug IDs, so you don't need an `inject` step.
+
+With `false`, the SDK turns on source maps only when [`sourcemaps.delete`](#sourcemaps.delete) is `false`.
+
+
+
+
+
+Whether the SDK injects debug IDs into the bundles and their source maps.
+
+With `false`, the SDK adds no debug IDs and uploads no source maps, because the upload matches files by debug ID. Use this when another tool injects the debug IDs and uploads the source maps, for example the Sentry CLI.
+
+
+
+
+
+Whether the SDK removes source maps from the build output.
+
+- Not set: the SDK removes the source maps it turned on itself, that is, when `build.sourcemap` isn't set in your Vite config. Source maps that you turned on stay.
+- `true`: the SDK removes all source maps of the build, also the ones you turned on. The SDK switches `build.sourcemap: true` to `"hidden"`, so that no `sourceMappingURL` comment points to a removed file.
+- `false`: the SDK removes no source maps. When `build.sourcemap` isn't set, the SDK turns on hidden source maps, and they stay in the build output.
+
+`true` and `false` don't depend on an upload. They also apply when the upload is turned off, when it can't run (for example, without an auth token), and when it fails.
+
+The SDK removes the `.map` files after the adapter ran, from the adapter output folder and from hidden folders such as `.svelte-kit` and `.vercel`.
+
+To keep the source maps for a manual upload later, set `upload: false` and `delete: false`:
+
+```javascript {filename:vite.config.(js|ts)} {7-10}
+import { sveltekit } from "@sveltejs/kit/vite";
+import { sentrySvelteKit } from "@sentry/sveltekit/vite";
+
+export default {
+ plugins: [
+ sentrySvelteKit({
+ sourcemaps: {
+ upload: false,
+ delete: false,
+ },
+ }),
+ sveltekit(),
+ ],
+ // ... rest of your Vite config
+};
+```
+
## Auto-Instrumentation Options
diff --git a/docs/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.mdx b/docs/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.mdx
index e5aa905dd8e98..4f0adbb48e98f 100644
--- a/docs/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.mdx
+++ b/docs/platforms/javascript/guides/tanstackstart-react/features/sentryTanstackStart.mdx
@@ -11,7 +11,7 @@ The plugin also loads your `instrument.server` file in production builds that us
## Usage
-To automatically upload source maps, you need to provide your Sentry auth token, organization, and project slugs in your Vite configuration. The plugin then, by default, automatically enables hidden source maps and deletes `.map` files after upload.
+To automatically upload source maps, you need to provide your Sentry auth token, organization, and project slugs in your Vite configuration. When you don't set `build.sourcemap` in your Vite config, the plugin turns on hidden source maps, uploads them, and removes them from the build output. Source maps that you turn on yourself are uploaded and stay in the build output.
diff --git a/docs/product/sentry-basics/getting-started-tutorial/enable-readable-stack-traces.mdx b/docs/product/sentry-basics/getting-started-tutorial/enable-readable-stack-traces.mdx
index e2c22d765a748..0605e2f54732a 100644
--- a/docs/product/sentry-basics/getting-started-tutorial/enable-readable-stack-traces.mdx
+++ b/docs/product/sentry-basics/getting-started-tutorial/enable-readable-stack-traces.mdx
@@ -75,9 +75,6 @@ import react from "@vitejs/plugin-react";
import { sentryVitePlugin } from "@sentry/bundler-plugins/vite";
export default defineConfig({
- build: {
- sourcemap: true,
- },
plugins: [
react(),
sentryVitePlugin({
@@ -97,7 +94,7 @@ Your `org` and `project` here must point to the **same frontend project** as the
-By default, the plugin deletes the source map files from your build output after uploading them, so they're not served to your users in production.
+The plugin turns on source maps for the production build, uploads them, and then removes them from your build output, so they're not served to your users in production.
## 4. Trigger the Error Again
diff --git a/includes/bundler-plugin-source-maps/esbuild.mdx b/includes/bundler-plugin-source-maps/esbuild.mdx
new file mode 100644
index 0000000000000..07ef66ef48396
--- /dev/null
+++ b/includes/bundler-plugin-source-maps/esbuild.mdx
@@ -0,0 +1,7 @@
+You don't need to turn on source maps. When `sourcemap` isn't set, the plugin sets it to `"external"`, uploads the source maps to Sentry, and deletes them from the build output after the upload. It does this only when it can upload, that is, when it has an auth token, an organization, and a project.
+
+
+
+If you set `sourcemap` yourself, the plugin uploads these source maps and keeps them in the build output, where they can be public. To delete them after the upload, set [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete).
+
+
diff --git a/includes/bundler-plugin-source-maps/rollup.mdx b/includes/bundler-plugin-source-maps/rollup.mdx
new file mode 100644
index 0000000000000..e5b57b8fb6c51
--- /dev/null
+++ b/includes/bundler-plugin-source-maps/rollup.mdx
@@ -0,0 +1,7 @@
+You don't need to turn on source maps. When `output.sourcemap` isn't set, the plugin turns on hidden source maps, uploads them to Sentry, and removes them from the build output. It does this only when it can upload, that is, when it has an auth token, an organization, and a project.
+
+
+
+If you set `output.sourcemap` yourself, the plugin uploads these source maps and keeps them in the build output, where they can be public. To remove them after the upload, set [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete).
+
+
diff --git a/includes/bundler-plugin-source-maps/vite.mdx b/includes/bundler-plugin-source-maps/vite.mdx
new file mode 100644
index 0000000000000..431421677595a
--- /dev/null
+++ b/includes/bundler-plugin-source-maps/vite.mdx
@@ -0,0 +1,7 @@
+You don't need to turn on source maps. When `build.sourcemap` isn't set, the plugin turns on hidden source maps, uploads them to Sentry, and removes them from the build output. It does this only when it can upload, that is, when it has an auth token, an organization, and a project.
+
+
+
+If you set `build.sourcemap` yourself, the plugin uploads these source maps and keeps them in the build output, where they can be public. To remove them after the upload, set [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete).
+
+
diff --git a/includes/bundler-plugin-source-maps/webpack.mdx b/includes/bundler-plugin-source-maps/webpack.mdx
new file mode 100644
index 0000000000000..85fb36a5e535a
--- /dev/null
+++ b/includes/bundler-plugin-source-maps/webpack.mdx
@@ -0,0 +1,7 @@
+You don't need to turn on source maps. When `devtool` isn't set, the plugin sets it to `"hidden-source-map"`, uploads the source maps to Sentry, and removes them from the build output. It does this only when it can upload, that is, when it has an auth token, an organization, and a project.
+
+
+
+If you set `devtool` yourself, the plugin uploads these source maps and keeps them in the build output, where they can be public. To remove them after the upload, set [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete).
+
+
diff --git a/includes/react-router/source-maps-upload.mdx b/includes/react-router/source-maps-upload.mdx
index 78537cc821dc9..34249229b4681 100644
--- a/includes/react-router/source-maps-upload.mdx
+++ b/includes/react-router/source-maps-upload.mdx
@@ -23,3 +23,17 @@ export default {
+ },
} satisfies Config;
```
+
+When you don't set `build.sourcemap` in your Vite config, the SDK turns on hidden source maps for the client and server builds. After the upload, `sentryOnBuildEnd` removes the `.map` files from your build directory. When you turn on source maps yourself, the SDK uploads them and they stay.
+
+To change this, set the [`sourcemaps.upload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.upload), [`sourcemaps.injectDebugIds`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.injectDebugIds), and [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) options in your Sentry config. For example, to keep the source maps for a manual upload later:
+
+```typescript {filename: vite.config.ts}
+const sentryConfig: SentryReactRouterBuildOptions = {
+ // ...
+ sourcemaps: {
+ upload: false,
+ delete: false,
+ },
+};
+```
diff --git a/platform-includes/getting-started-cloudflare/javascript.nuxt.mdx b/platform-includes/getting-started-cloudflare/javascript.nuxt.mdx
index d625c13e19cca..e973e3ead80b2 100644
--- a/platform-includes/getting-started-cloudflare/javascript.nuxt.mdx
+++ b/platform-includes/getting-started-cloudflare/javascript.nuxt.mdx
@@ -180,6 +180,10 @@ export default defineNuxtConfig({
});
```
+Sentry uploads these source maps and keeps them in the build output, where they can be public.
+
+To remove all source maps from the build output, set [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) in the `sentry` options.
+
### Control the Data You Send to Sentry
diff --git a/platform-includes/getting-started-complete/javascript.nuxt.mdx b/platform-includes/getting-started-complete/javascript.nuxt.mdx
index b7489d7e7ba18..adaa7d87c4dd9 100644
--- a/platform-includes/getting-started-complete/javascript.nuxt.mdx
+++ b/platform-includes/getting-started-complete/javascript.nuxt.mdx
@@ -188,6 +188,10 @@ export default defineNuxtConfig({
});
```
+Sentry uploads these source maps and keeps them in the build output, where they can be public.
+
+To remove all source maps from the build output, set [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) in the `sentry` options.
+
### Control the Data You Send to Sentry
diff --git a/platform-includes/getting-started-complete/javascript.remix.mdx b/platform-includes/getting-started-complete/javascript.remix.mdx
index ec8ff98169bac..0739cb16d8131 100644
--- a/platform-includes/getting-started-complete/javascript.remix.mdx
+++ b/platform-includes/getting-started-complete/javascript.remix.mdx
@@ -231,7 +231,7 @@ export default defineConfig({
To upload source maps for clear error stack traces, pass your Sentry organization, project, and auth token to `sentryRemixVitePlugin` from the previous step. It injects debug IDs, uploads the source maps during your production build, and deletes them from your build output afterwards.
-The plugin also turns on hidden source maps for you, unless you set `build.sourcemap` yourself.
+The plugin also turns on hidden source maps for you, unless you set `build.sourcemap` yourself. Source maps that you turn on yourself stay in the build output.
diff --git a/platform-includes/sourcemaps/overview/javascript.astro.mdx b/platform-includes/sourcemaps/overview/javascript.astro.mdx
index 6d2e2aa84d71e..d156106e8bc54 100644
--- a/platform-includes/sourcemaps/overview/javascript.astro.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.astro.mdx
@@ -29,9 +29,28 @@ export default defineConfig({
});
```
+When you don't set `vite.build.sourcemap` in your Astro config, the SDK turns on hidden source maps for the client and server builds, uploads them, and removes them from the build output. When you turn on source maps yourself, the SDK uploads them and they stay. With an older Cloudflare adapter that writes the Worker to a `_worker.js` folder, the source maps in that folder stay, so that Wrangler can read them.
+
+To change this, use the [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) option.
+
### Disable Source Maps Upload
-You can disable automatic source maps upload in your Astro configuration with `disable: true` under `sourcemaps` in the `sentry` integration options.
+To turn off the source maps upload, set `upload: false` under `sourcemaps` in the `sentry` integration options. The SDK still injects debug IDs. To keep the source maps for a manual upload later, also set `delete: false`:
+
+```javascript {filename:astro.config.mjs}
+export default defineConfig({
+ integrations: [
+ sentry({
+ sourcemaps: {
+ upload: false,
+ delete: false,
+ },
+ }),
+ ],
+});
+```
+
+To also turn off the debug ID injection, set `injectDebugIds: false`. See the [bundler plugin options](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.upload) for details.
### Setting the Source Maps Assets Directory
diff --git a/platform-includes/sourcemaps/overview/javascript.nextjs.mdx b/platform-includes/sourcemaps/overview/javascript.nextjs.mdx
index 8e52e9c980bde..e3177ef9b1f1e 100644
--- a/platform-includes/sourcemaps/overview/javascript.nextjs.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.nextjs.mdx
@@ -16,6 +16,8 @@ SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
Add `withSentryConfig` to your Next.js config with your org, project, and auth token.
+You don't need to turn source maps on. If you haven't set them, the SDK turns them on, uploads them, and removes the client-side source maps from the build output. Server-side source maps stay.
+
With **Turbopack** (Next.js 15+ default), source maps upload after the build completes.
@@ -41,7 +43,7 @@ export default withSentryConfig(nextConfig, {
| Option | Default | Description |
| ---------------------------------------- | ------- | ----------------------------------------------------------- |
-| `sourcemaps.deleteSourcemapsAfterUpload` | `true` | Delete **client-side** source maps after upload. Server source maps are kept for runtime error reporting. |
+| `sourcemaps.delete` | not set | Remove **client-side** source maps from the build output. `true` removes all of them, `false` keeps all of them. When not set, see `sourcemaps.delete`. Server source maps are kept for runtime error reporting. |
| `widenClientFileUpload` | `false` | Upload dependency source maps to fix `[native code]` frames |
See Build Options for all available options.
diff --git a/platform-includes/sourcemaps/overview/javascript.nitro.mdx b/platform-includes/sourcemaps/overview/javascript.nitro.mdx
index ee222af021b9f..54f68150812e8 100644
--- a/platform-includes/sourcemaps/overview/javascript.nitro.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.nitro.mdx
@@ -2,16 +2,16 @@
When you wrap your config with `withSentryConfig`, the SDK:
-1. Enables source map generation if you haven't set the `sourcemap` option yourself
+1. Turns on hidden source maps if you haven't set the `sourcemap` option yourself
2. Injects debug IDs into your build output
3. Uploads source maps to Sentry after each production build
-4. Deletes `.map` files from the build output to avoid exposing them publicly
+4. Deletes the `.map` files it turned on from the build output, so that they aren't public
Source maps are only uploaded during **production builds**. Development builds (`nitro dev`) skip the upload.
If you already set `sourcemap` in your Nitro config, the SDK respects your setting:
-- `true`: the SDK uploads the generated maps
+- `true` or `"hidden"`: the SDK uploads the generated maps and keeps them in the build output
- `false`: the SDK warns that errors won't be unminified and skips the upload
### Source Map Options
@@ -36,30 +36,31 @@ export default withSentryConfig(config, {
assets: [".output/server/**"],
// Glob pattern for files to exclude from upload
ignore: ["node_modules/**"],
- // Delete source maps after upload to avoid exposing them publicly
- filesToDeleteAfterUpload: [".output/server/**/*.map"],
},
});
```
+To delete all source maps from the build output, also the ones you turned on, set [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) to `true`. With `false`, the SDK deletes no source maps.
+
### Disabling Source Map Uploads
-To disable source map uploads entirely, set `sourcemaps.disable` to `true`:
+To turn off the upload, set [`sourcemaps.upload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.upload) to `false`. The SDK still injects debug IDs, so you can upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`. To keep the source maps in the build output for this upload, also set `sourcemaps.delete` to `false`:
```typescript {filename:nitro.config.ts}
export default withSentryConfig(config, {
sourcemaps: {
- disable: true,
+ upload: false,
+ delete: false,
},
});
```
-To generate and inject debug IDs without uploading (useful if you upload maps separately), set `sourcemaps.disable` to `"disable-upload"`:
+To also turn off debug ID injection, set [`sourcemaps.injectDebugIds`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.injectDebugIds) to `false`. The SDK then injects no debug IDs and uploads no source maps. Use this when another tool injects the debug IDs and uploads the source maps, for example the Sentry CLI:
```typescript {filename:nitro.config.ts}
export default withSentryConfig(config, {
sourcemaps: {
- disable: "disable-upload",
+ injectDebugIds: false,
},
});
```
diff --git a/platform-includes/sourcemaps/overview/javascript.nuxt.mdx b/platform-includes/sourcemaps/overview/javascript.nuxt.mdx
index 6cb5dd02670a6..586057c180f3d 100644
--- a/platform-includes/sourcemaps/overview/javascript.nuxt.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.nuxt.mdx
@@ -53,7 +53,9 @@ When you open your browser's developer tools, the browser tries to fetch source
#### 3. Source Map Options
-Configure source map behavior in your Nuxt config:
+Nuxt turns on server-side source maps and turns off client-side source maps by default. The Sentry Nuxt Module keeps these settings. It uploads the source maps that Nuxt generates and keeps them in the build output.
+
+Source maps in the client build output can be public. To remove all source maps of the client and server build, also the ones you turned on, set [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) to `true`:
```javascript {filename:nuxt.config.ts}
export default defineNuxtConfig({
@@ -64,20 +66,20 @@ export default defineNuxtConfig({
authToken: process.env.SENTRY_AUTH_TOKEN,
sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: [".*/**/public/**/*.map", ".output/**/public/**/*.map"]
+ delete: true,
}
},
});
```
+To upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`, set `sourcemaps: { upload: false, delete: false }`. Sentry then uploads nothing, but it still injects debug IDs and keeps the source maps in the build output.
+
Generating source maps **may expose them to the public**, potentially causing your
source code to be leaked. You can prevent this by configuring your server to deny access to `.js.map` files, or by
- using [Sentry Vite Plugin's
- `sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.filesToDeleteAfterUpload)
- option to delete source maps after they've been uploaded to Sentry.
+ using the
+ [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete)
+ option to delete source maps after the build.
### Troubleshooting
diff --git a/platform-includes/sourcemaps/overview/javascript.remix.mdx b/platform-includes/sourcemaps/overview/javascript.remix.mdx
index 89e439dbadb4e..cb323e507139a 100644
--- a/platform-includes/sourcemaps/overview/javascript.remix.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.remix.mdx
@@ -39,17 +39,27 @@ The plugin reads `SENTRY_AUTH_TOKEN`, `SENTRY_ORG`, and `SENTRY_PROJECT` from yo
During a production build, the plugin injects debug IDs, uploads the source maps, and then deletes the `.map` files it generated from your build output. It skips uploading in development, so `vite dev` doesn't create a new set of artifacts on every restart.
-If you don't set `build.sourcemap` yourself, the plugin turns on hidden source maps. If you do set it, the plugin keeps your setting and leaves your source maps in place, so you control whether they're deleted with `sourcemaps.filesToDeleteAfterUpload`.
+If you don't set `build.sourcemap` yourself, the plugin turns on hidden source maps, uploads them, and removes them from the build output. If you do set it, the plugin keeps your setting and leaves your source maps in place. To change this, use [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete): `true` removes all source maps of the build, also the ones you turned on, and `false` keeps all of them.
Generating source maps **may expose them to the public**, potentially causing
your source code to be leaked. If you turn on source maps yourself, prevent
this by configuring your server to deny access to `.js.map` files, or by
- setting `sourcemaps.filesToDeleteAfterUpload` to delete them after they've
- been uploaded to Sentry.
+ setting `sourcemaps.delete` to `true`.
-To turn uploading off, set `sourcemaps.disable` to `true`. To keep the debug IDs and upload the maps yourself, set it to `'disable-upload'`.
+To turn uploading off, set [`sourcemaps.upload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.upload) to `false`. The plugin still injects debug IDs. To keep the source maps for a manual upload later, also set `sourcemaps.delete` to `false`:
+
+```typescript {filename:vite.config.ts}
+sentryRemixVitePlugin({
+ sourcemaps: {
+ upload: false,
+ delete: false,
+ },
+});
+```
+
+To also turn off the debug ID injection, set [`sourcemaps.injectDebugIds`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.injectDebugIds) to `false`.
### Using `npx @sentry/remix --upload-sourcemaps`
diff --git a/platform-includes/sourcemaps/overview/javascript.solidstart.mdx b/platform-includes/sourcemaps/overview/javascript.solidstart.mdx
index e05cabe3fa1c2..a954f82c4864c 100644
--- a/platform-includes/sourcemaps/overview/javascript.solidstart.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.solidstart.mdx
@@ -43,6 +43,8 @@ export default defineConfig(
#### 2. Source Map Options
+When you don't set `build.sourcemap` in your Vite config, the SDK turns on hidden source maps, uploads them to Sentry, and removes them from the build output. On SolidStart 2, the SDK does the same for the server build when you don't set `sourcemap` in your Nitro config. Source maps that you turn on yourself are uploaded and stay in the build output.
+
Configure source map behavior in your SolidStart config:
```javascript {filename:app.config.ts}
@@ -58,16 +60,17 @@ export default defineConfig(
sourcemaps: {
assets: ["./dist/**/*"],
ignore: ["**/node_modules/**"],
- filesToDeleteAfterUpload: ["./**/*.map", "./dist/**/*.map"],
},
},
),
);
```
+To remove all source maps from the build output, also the ones you turned on, set [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) to `true`. With `false`, the SDK removes no source maps.
+
### Disable Source Maps Upload
-You can disable automatic source maps upload in your SolidStart configuration:
+To turn off the upload, set [`sourcemaps.upload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.upload) to `false`. The SDK still injects debug IDs, so you can upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`. To keep the source maps in the build output for this upload, also set `sourcemaps.delete` to `false`:
```javascript {filename:app.config.ts}
export default defineConfig(
@@ -76,7 +79,10 @@ export default defineConfig(
/* Your SolidStart config */
},
{
- disable: true,
+ sourcemaps: {
+ upload: false,
+ delete: false,
+ },
},
),
);
diff --git a/platform-includes/sourcemaps/overview/javascript.svelte.mdx b/platform-includes/sourcemaps/overview/javascript.svelte.mdx
index 75a2ed86f9691..166c52fdade74 100644
--- a/platform-includes/sourcemaps/overview/javascript.svelte.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.svelte.mdx
@@ -73,9 +73,6 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
import { sentryVitePlugin } from "@sentry/bundler-plugins/vite";
export default defineConfig({
- build: {
- sourcemap: "hidden", // Source map generation must be turned on ("hidden", true, etc.)
- },
plugins: [
svelte(),
@@ -84,24 +81,12 @@ export default defineConfig({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
```
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to deny access to `.js.map` files, or by
- using Sentry Vite Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/platform-includes/sourcemaps/overview/javascript.sveltekit.mdx b/platform-includes/sourcemaps/overview/javascript.sveltekit.mdx
index 745f393984a3b..3e658ec2f9021 100644
--- a/platform-includes/sourcemaps/overview/javascript.sveltekit.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.sveltekit.mdx
@@ -54,7 +54,9 @@ export default defineConfig({
#### 2. Source Map Options
-Configure source map behavior in your Vite config:
+When you don't set `build.sourcemap` in your Vite config, the SDK turns on hidden source maps, uploads them, and removes them from the build output. When you turn on source maps yourself, the SDK uploads them and they stay.
+
+To change this, use the `sourcemaps` options. For example, to keep the source maps in the build output:
```javascript {filename:vite.config.js}
import { sveltekit } from "@sveltejs/kit/vite";
@@ -66,6 +68,9 @@ export default defineConfig({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
+ sourcemaps: {
+ delete: false,
+ },
}),
sveltekit(),
],
@@ -108,6 +113,8 @@ export default defineConfig({
});
```
+With `autoUploadSourceMaps: false`, the SDK also doesn't turn on source maps or inject debug IDs. To upload the source maps yourself later, set `sourcemaps.upload` to `false` instead.
+
### Troubleshooting
If you're experiencing issues with source maps, see [Troubleshooting Source Maps](/platforms/javascript/guides/sveltekit/troubleshooting/).
diff --git a/platform-includes/sourcemaps/overview/javascript.tanstackstart-react.mdx b/platform-includes/sourcemaps/overview/javascript.tanstackstart-react.mdx
index 112c4375adcfe..82d62ec7a9827 100644
--- a/platform-includes/sourcemaps/overview/javascript.tanstackstart-react.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.tanstackstart-react.mdx
@@ -40,7 +40,7 @@ export default defineConfig({
### Source Map Options
-The plugin, by default, automatically enables hidden source maps and deletes `.map` files after upload.
+When you don't set `build.sourcemap` in your Vite config, the plugin turns on hidden source maps for the client and server builds, uploads them to Sentry, and removes them from the build output. Source maps that you turn on yourself are uploaded and stay in the build output.
Configure source map behavior using the [plugin options](/platforms/javascript/sourcemaps/uploading/vite/), for example:
@@ -60,24 +60,21 @@ export default defineConfig({
sourcemaps: {
assets: ["./dist/**/*"],
ignore: ["**/node_modules/**"],
- filesToDeleteAfterUpload: [
- "./**/*.map",
- ".*/**/public/**/*.map",
- "./dist/**/client/**/*.map",
- ],
},
}),
],
});
```
+To remove all source maps from the build output, also the ones you turned on, set [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete) to `true`. To upload the source maps yourself later, for example with `sentry-cli sourcemaps upload`, set `sourcemaps: { upload: false, delete: false }`. The plugin then uploads nothing, but it still injects debug IDs and keeps the source maps in the build output.
+
Generating source maps **may expose them to the public**, potentially causing
- your source code to be leaked. The `sentryTanstackStart` plugin automatically
- deletes source map files after upload by default. If you customize this
- behavior, ensure your server denies access to `.js.map` files, or configure
- [`sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/vite/)
- to delete source maps after upload.
+ your source code to be leaked. The `sentryTanstackStart` plugin removes the
+ source maps it turned on, but keeps the ones you turned on. To remove these
+ too, set
+ [`sourcemaps.delete: true`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete),
+ or ensure your server denies access to `.js.map` files.
### Troubleshooting
diff --git a/platform-includes/sourcemaps/overview/javascript.vue.mdx b/platform-includes/sourcemaps/overview/javascript.vue.mdx
index c99da813efd0d..c90cd6524b141 100644
--- a/platform-includes/sourcemaps/overview/javascript.vue.mdx
+++ b/platform-includes/sourcemaps/overview/javascript.vue.mdx
@@ -64,9 +64,6 @@ import { sentryVitePlugin } from "@sentry/bundler-plugins/vite";
// https://vitejs.dev/config/
export default defineConfig({
- build: {
- sourcemap: "hidden", // Source map generation must be turned on
- },
plugins: [
vue(),
@@ -75,24 +72,12 @@ export default defineConfig({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
-
- sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: ["./**/*.map", ".*/**/public/**/*.map", "./dist/**/client/**/*.map"]
- }
}),
],
});
```
-
- Generating source maps **may expose them to the public**, potentially causing your
- source code to be leaked. You can prevent this by configuring your server to deny access to `.js.map` files, or by
- using Sentry Vite Plugin's
- `sourcemaps.filesToDeleteAfterUpload`
- option to delete source maps after they've been uploaded to Sentry.
-
+
diff --git a/platform-includes/sourcemaps/primer/javascript.nuxt.mdx b/platform-includes/sourcemaps/primer/javascript.nuxt.mdx
index 59632620a68c6..b517ef21d76f3 100644
--- a/platform-includes/sourcemaps/primer/javascript.nuxt.mdx
+++ b/platform-includes/sourcemaps/primer/javascript.nuxt.mdx
@@ -28,30 +28,26 @@ To enable client-side source maps, you need to do so explicitly. Nuxt applies de
To enable client-side source map generation, add the following to your Nuxt configuration:
-```javascript {filename:nuxt.config.ts} {2,5-12}
+```javascript {filename:nuxt.config.ts} {2,5-7}
export default defineNuxtConfig({
sourcemap: { client: "hidden" },
sentry: {
sourcemaps: {
- // As you're enabling client source maps, you probably want to delete them after they're uploaded to Sentry.
- // Set the appropriate glob pattern for your output folder - some glob examples below:
- filesToDeleteAfterUpload: [
- "./**/*.map",
- ".*/**/public/**/*.map",
- ".output/**/public/**/*.map"
- ]
- }
+ delete: true,
+ },
},
});
```
+Sentry uploads the source maps that Nuxt generates and keeps them in the build output. With `sourcemaps.delete: true`, Sentry removes all source maps of the client and server build from the build output.
+
Generating source maps **may expose them to the public**, potentially causing your
source code to be leaked. You can prevent this by configuring your server to deny access to `.js.map` files, or by
- using [Sentry Vite Plugin's
- `sourcemaps.filesToDeleteAfterUpload`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.filesToDeleteAfterUpload)
- option to delete source maps after they've been uploaded to Sentry.
+ using the
+ [`sourcemaps.delete`](/platforms/javascript/sourcemaps/uploading/bundler-plugin-options/#sourcemaps.delete)
+ option to delete source maps after the build.
The `hidden` option functions the same as `true`, by enabling source map generation. However, it also suppresses the source map reference comments that normally appear at the end of each generated file in the build output. This option keeps the source maps available without exposing their references in the files.
diff --git a/platform-includes/sourcemaps/upload/primer/javascript.sveltekit.mdx b/platform-includes/sourcemaps/upload/primer/javascript.sveltekit.mdx
index 79c93fe859d73..e942686aed83b 100644
--- a/platform-includes/sourcemaps/upload/primer/javascript.sveltekit.mdx
+++ b/platform-includes/sourcemaps/upload/primer/javascript.sveltekit.mdx
@@ -54,6 +54,8 @@ SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___
+When you don't set `build.sourcemap` in your Vite config, the SDK turns on hidden source maps and removes them from the build output after the upload. Source maps that you turned on yourself stay. To change this, use the `sourcemaps` options.
+
### Override SvelteKit Adapter Detection
By default, `sentrySvelteKit` will try to detect your SvelteKit adapter to configure the source maps upload correctly. If you're not using one of the [supported adapters](/platforms/javascript/guides/sveltekit/) or the wrong one is detected, you can override the adapter detection by passing the `adapter` option to `sentrySvelteKit`:
@@ -92,4 +94,6 @@ export default {
};
```
+With `autoUploadSourceMaps: false`, the SDK also doesn't turn on source maps or inject debug IDs. To upload the source maps yourself later, set `sourcemaps.upload` to `false` instead.
+
If you disable automatic source maps upload, you must explicitly set a `release` value in your `Sentry.init()` configuration. This is important for Sentry features like release health and correctly associating errors with specific deployments.