Source Maps

To enable readable stack traces in your Sentry errors, you need to upload your source maps to Sentry.

Readable Stack Traces

Upload Source Maps for a Svelte Project

Using the Sentry Wizard

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

npx @sentry/wizard@latest -i sourcemaps

The wizard will guide you through the following steps:

  • Logging into Sentry and selecting a
    projectRepresents your service in Sentry and allows you to scope events to a distinct application.
  • Installing the necessary Sentry packages
  • Configuring your build tool to generate and upload source maps
  • Configuring your CI to upload source maps

If you want to configure source maps upload manually, follow the guide for your bundler or build tool below.

Manually Configuring Source Maps Upload

To generate source maps with your Svelte

projectRepresents your service in Sentry and allows you to scope events to a distinct application.
, you need to set the source map compiler options in your Svelte config:

import sveltePreprocess from "svelte-preprocess";

const config = {
  compilerOptions: {
    enableSourcemap: true,
  preprocess: sveltePreprocess({
    sourceMap: true,

export default config;

If you're using Vite in you Svelte project, you can use Sentry's Vite plugin for convenience:

npm install @sentry/vite-plugin --save-dev

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 a .env.sentry-build-plugin file in the working directory when building your project. You likely want to add the auth token as an environment variable to your CI/CD environment.


Configure Vite to emit source maps and use the Sentry Vite plugin:

import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { sentryVitePlugin } from "@sentry/vite-plugin";

export default defineConfig({
  build: {
    sourcemap: true, // Source map generation must be turned on
  plugins: [

    // Put the Sentry vite plugin after all other plugins
      org: "example-org",
      project: "example-project",
      authToken: process.env.SENTRY_AUTH_TOKEN,

Other Bundlers

If you're using a bundler other than Vite, check out our general guide on how to upload source maps, or refer to your bundler's documentation.

Additional Resources

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