Source Maps
To enable readable stack traces in your Sentry errors, you need to upload your source maps to Sentry.
The easiest way to configure uploading source maps is by using the Sentry Wizard:
Copied
npx @sentry/wizard@latest -i sourcemaps
The wizard will guide you through the following steps:
- Logging into Sentry and selecting a project
- Installing the necessary Sentry packages
- Configuring your build tool to generate and upload source maps
- Configuring your CI to upload source maps
If you want to configure source maps upload with Angular manually, follow the steps below.
To generate source maps, you need to add the sourceMap
option to your angular.json
build configuration:
angular.json
Copied
{
// ...
"projects": {
"my-app": {
"architect": {
"build": {
"configurations": {
"production": {
"sourceMap": {
"scripts": true
}
}
}
}
}
}
}
}
To upload your Angular project's source maps to Sentry, we recommend one of these options:
- Angular CLI and Sentry webpack plugin
Use the Angular CLI, a custom Angular builder and the Sentry webpack plugin to set releases and upload source maps automatically when runningng build
. - Nx Angular CLI and Sentry webpack plugin
If you're using Nx, use@nx/angular
CLI and the Sentry webpack plugin to set releases and upload source maps automatically when runningnx build
. - Sentry CLI
Upload source maps manually using the Sentry CLI.
Take a look at this guide for further options to upload source maps.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").