Skip to content
Docs GitHub

sourcemap

Manage sourcemaps

Commands

sentry sourcemap inject <directory>

Inject debug IDs into JavaScript files and sourcemaps

Arguments:

ArgumentDescription
<directory>Directory to scan for JS + sourcemap pairs

Options:

OptionDescription
--ext <ext>Comma-separated file extensions to process (default: .js,.cjs,.mjs)
--dry-runShow what would be modified without writing

sentry sourcemap upload <directory>

Upload sourcemaps to Sentry

Arguments:

ArgumentDescription
<directory>Directory containing sourcemaps

Options:

OptionDescription
--release <release>Release version to associate with the upload
--url-prefix <url-prefix>URL prefix for uploaded files (default: ~/)

All commands support --json for machine-readable output and --fields to select specific JSON fields.

Examples

Inject debug IDs

Terminal window
# Inject debug IDs into all JS files in dist/
sentry sourcemap inject ./dist
# Preview changes without writing
sentry sourcemap inject ./dist --dry-run
# Only process specific extensions
sentry sourcemap inject ./build --ext .js,.mjs

Upload sourcemaps

Terminal window
# Upload sourcemaps from dist/
sentry sourcemap upload ./dist
# Associate with a release
sentry sourcemap upload ./dist --release 1.0.0
# Set a custom URL prefix
sentry sourcemap upload ./dist --url-prefix '~/static/js/'