---
title: "Webpack"
description: "Upload your source maps with our webpack plugin."
url: https://docs.sentry.io/platforms/javascript/guides/wasm/sourcemaps/uploading/webpack/
---

# Webpack for Wasm

This guide assumes you're using a Sentry **SDK version `7.47.0` or higher**. If you're on an older version and you want to upload source maps, we recommend upgrading your SDK to the newest version.

You can use the Sentry webpack plugin to automatically create releases and upload source maps to Sentry when bundling your app.

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

The easiest way to configure source map uploading with webpack 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

If you'd rather configure source map uploading with webpack manually, follow the steps below.

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

Install the Sentry webpack plugin:

```bash
npm install @sentry/bundler-plugins --save-dev
```

*Other available variations of the above snippet: yarn, pnpm*

### [Configuration](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/webpack.md#configuration)

To upload source maps you have to configure an [Organization Token](https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/).

Alternatively, you can also use a [Personal Token](https://sentry.io/orgredirect/organizations/:orgslug/settings/account/api/auth-tokens/), with the "Project: Read & Write" and "Release: Admin" permissions.

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 (don't forget to add it to your `.gitignore` file, as this is sensitive data) in the working directory when building your project. We recommend you add the auth token to your CI/CD environment as an environment variable.

Learn more about configuring the plugin in our [Sentry webpack plugin documentation](https://docs.sentry.io/platforms/javascript/guides/wasm/sourcemaps/uploading/bundler-plugin-options.md).

```bash
SENTRY_AUTH_TOKEN=<your-sentry-auth-token>
```

And the following webpack config:

```javascript
const { sentryWebpackPlugin } = require("@sentry/bundler-plugins/webpack");

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

  plugins: [
    sentryWebpackPlugin({
      org: "<your-org-slug>",
      project: "<your-project-slug>",
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
};
```

You don't need to turn on source maps. When `devtool` isn't set, the plugin sets it to `"hidden-source-map"`, uploads the source maps to Sentry, and removes them from the build output. It does this only when it can upload, that is, when it has an auth token, an organization, and a project.

If you set `devtool` yourself, the plugin uploads these source maps and keeps them in the build output, where they can be public. To remove them after the upload, set [`sourcemaps.delete: true`](https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/bundler-plugin-options.md#sourcemaps.delete).

The Sentry webpack plugin doesn't upload source maps in watch-mode/development-mode. We recommend running a production build to test your configuration.

If you use [SourceMapDevToolPlugin](https://webpack.js.org/plugins/source-map-dev-tool-plugin) for more fine-grained control of source map generation, turn off `noSources` so Sentry can display proper source code context in event stack traces.

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
