---
title: "Source Maps"
description: "Upload your source maps to Sentry to enable readable stack traces in your errors."
url: https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/
---

# Source Maps | Sentry for Angular

To enable readable stack traces in your Sentry errors, you need to upload your source maps to [Sentry](https://sentry.io/welcome/).

The easiest way to configure uploading source maps is by using the [Sentry Wizard](https://docs.sentry.io/platforms/javascript/sourcemaps.md#uploading-source-maps).

See how uploading source maps lets you see the exact line of code that caused an error:

## [Uploading Source Maps in an Angular project](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps.md#uploading-source-maps-in-an-angular-project)

### [Automatic Setup](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps.md#automatic-setup)

The easiest way to configure uploading source maps is by using the Sentry Wizard:

```bash
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

### [Manual Setup](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps.md#manual-setup)

If you want to configure source maps upload with Angular manually, follow the steps below.

#### [Generating Source Maps](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps.md#generating-source-maps)

To generate source maps, you need to add the `sourceMap` option to your `angular.json` build configuration:

`angular.json`

```json
{
  // ...
  "projects": {
    "my-app": {
      "architect": {
        "build": {
          "configurations": {
            "production": {
              "sourceMap": {
                "scripts": 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 deleting the sourcemaps before deploying your application.

#### [Uploading Source Maps](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps.md#uploading-source-maps)

To upload your Angular project's source maps to Sentry, we recommend one of these options:

* [Angular CLI and Sentry webpack plugin](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/uploading/angular-webpack.md)\
  Use the Angular CLI, a custom Angular builder and the Sentry webpack plugin to set releases and upload source maps automatically when running `ng build`.
* [Nx Angular CLI and Sentry webpack plugin](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/uploading/angular-nx.md)\
  If you're using Nx, use `@nx/angular` CLI and the Sentry webpack plugin to set releases and upload source maps automatically when running `nx build`.
* [Sentry CLI](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/uploading/cli.md)\
  Upload source maps manually using the Sentry CLI.

Take a look at this [guide for further options to upload source maps](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/uploading.md).

## [Additional Resources](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps.md#additional-resources)

* [Using sentry-cli to Upload Source Maps](https://docs.sentry.io/cli/releases.md#sentry-cli-sourcemaps)
* [4 Reasons Why Your Source Maps Are Broken](https://blog.sentry.io/2018/10/18/4-reasons-why-your-source-maps-are-broken)

## Pages in this section

- [Uploading Source Maps](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/uploading.md)
- [Troubleshooting Source Maps](https://docs.sentry.io/platforms/javascript/guides/angular/sourcemaps/troubleshooting_js.md)
