Source Maps
Sentry supports un-minifying JavaScript via source maps, which lets you view source code context obtained from stack traces in their original untransformed form. This is particularly useful for debugging minified code (for example, UglifyJS), or transpiled code from a higher-level language (such as TypeScript and ES6).
Sentry will automatically fetch the source code and source maps by scraping the URLs within the stack trace. However, you may have legitimate reasons for disabling the JavaScript source fetching in Sentry.
Capturing Source Maps
Most modern JavaScript transpilers support source maps. Below you'll find our recommended instructions, but we also provide instructions for various common tools:
SystemJS is the default module loader for Angular projects. The SystemJS build tool can be used to bundle, transpile, and minify source code for use in production environments, and can be configured to output source maps.
builder.bundle("src/app.js", "dist/app.min.js", {
minify: true,
sourceMaps: true,
sourceMapContents: true,
});
Additional information can be found in our SystemJS documentation.
From here, you can upload your source maps to Sentry.
Additional Resources
- Using sentry-cli to Upload Source Maps
- Debuggable JavaScript with Source Maps
- 4 Reasons Why Your Source Maps Are Broken
- Debug Your Node.js Projects with Source Maps
- Package:
- npm:@sentry/browser
- Version:
- 5.29.0
- Repository:
- https://github.com/getsentry/sentry-javascript