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).

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:

We recommend using Sentry's Webpack plugin to configure source maps and upload them automatically during the build:

Copied
$ npm install --save-dev @sentry/webpack-plugin

Next you need to generate an access token for our API. Within your organization's settings, navigate to Developer Settings, create a new internal integration, and provide a name appropriate to your organization. Important: Select Releases -> Admin for Permissions.

You may configure sentry-cli through it's documented mechanisms, or instead simply bind required parameters when initializing the plugin:

webpack.config.js
Copied
const SentryWebpackPlugin = require("@sentry/webpack-plugin");

module.exports = {
  // other configuration
  configureWebpack: {
    plugins: [
      new SentryWebpackPlugin({
        // sentry-cli configuration
        authToken: process.env.SENTRY_AUTH_TOKEN,
        org: "exmaple-org",
        project: "example-project",

        // webpack specific configuration
        include: ".",
        ignore: ["node_modules", "webpack.config.js"],
      }),
    ],
  },
};

Additional information can be found in our Webpack documentation.

Additional Resources

You can edit this page on GitHub.