Angular CLI

You can use the Angular CLI together with our Sentry webpack plugin to automatically create releases and upload source maps to Sentry when building your app (with ng build, for example). Due to Angular's closed build system, to register the webpack plugin, you'll first need to configure a custom builder. In the end, you'll be able to automatically upload source maps whenever you're creating a production build of your app.


Install the custom webpack builder for Angular and the Sentry webpack plugin:

npm install --save-dev @angular-builders/custom-webpack @sentry/webpack-plugin


With these packages installed, configure your app to upload source maps in three steps:

1. Set up custom Angular builder

In your angular.json, replace the default builder (@angular-devkit/build-angular) with @angular-builders/custom-webpack:

  "projects": {
    "my-project": {
      "architect": {
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "customWebpackConfig": {
              "path": "./webpack.config.js"
            // ... other options
          // ... other options
        // ... other options
      // ... other options

2. Register the Sentry Webpack Plugin

To upload source maps you have to configure an auth

tokenIn search, a key-value pair or raw search term. Also, a value used for authorization.
. Auth tokens can be passed to the plugin explicitly with the authToken option, with a SENTRY_AUTH_TOKEN environment variable, or with an .env.sentry-build-plugin file in the working directory when building your
projectRepresents your service in Sentry and allows you to scope events to a distinct application.
. We recommend you add the auth token to your CI/CD environment as an environment variable.


Register the Sentry Webpack plugin in your webpack.config.js:

const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");

module.exports = {
  // ... other config above ...

  devtool: "source-map", // Source map generation must be turned on
  plugins: [
      org: "example-org",
      project: "example-project",
      authToken: process.env.SENTRY_AUTH_TOKEN,

Learn more about configuring the plugin in our Sentry webpack plugin documentation.

3. Upload

To upload the source maps, build your Angular application:

ng build # add --prod for Angular versions below 13
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").