Rollup

Sentry uses releases to match the correct source maps to your events. You can use the Sentry Rollup plugin to automatically create releases and upload source maps to Sentry when bundling your app.

Installation

Copied
npm install @sentry/rollup-plugin --save-dev

Configuration

Learn more about configuring the plugin in our Sentry Rollup Plugin documentation.

Example:

rollup.config.js
Copied
import { sentryRollupPlugin } from "@sentry/rollup-plugin";

export default {
  input: "./src/index.js",
  plugins: [
    // Put the Sentry rollup plugin after all other plugins
    sentryRollupPlugin({
      org: "example-org",
      project: "example-project",

      // Specify the directory containing build artifacts
      include: "./out",

      // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
      // and need `project:releases` and `org:read` scopes
      authToken: process.env.SENTRY_AUTH_TOKEN,

      // Optionally uncomment the line below to override automatic release name detection
      // release: process.env.RELEASE,
    }),
  ],
  output: {
    sourcemap: true, // Source map generation must be turned on
    dir: "./out",
  },
};

The Sentry Rollup plugin will automatically inject a release value into the SDK so you must either omit the release option from Sentry.init or make sure Sentry.init's release option matches the plugin's release option exactly:

Copied
Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",

  // When using the plugin, either remove the `release`` property here entirely or
  // make sure that the plugin's release option and the Sentry.init()'s release
  // option match exactly.
  // release: "my-example-release-1"
});
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").