Source Maps
Uploading Source Maps in a Vue Project
This guide assumes you are using the @sentry/vue
SDK on version 7.47.0
or higher.
If you are on an older version and you want to upload source maps we recommend upgrading your SDK to the newest version.
Using the Sentry Wizard
The easiest and recommended 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.
Manual Setup with Vite
If you are using Vue, chances are good you are using Vite to bundle your
Installation
npm install @sentry/vite-plugin --save-dev
Configuration
Learn more about configuring the plugin in our Sentry Vite Plugin documentation.
To upload source maps you have to configure an auth
authToken
option, with a SENTRY_AUTH_TOKEN
environment variable, or with a .env.sentry-build-plugin
file in the working directory when building your .env.sentry-build-plugin
SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
Example:
vite.config.js
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { sentryVitePlugin } from "@sentry/vite-plugin";
// https://vitejs.dev/config/
export default defineConfig({
build: {
sourcemap: true, // Source map generation must be turned on
},
plugins: [
vue(),
// Put the Sentry vite plugin after all other plugins
sentryVitePlugin({
org: "example-org",
project: "example-project",
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
],
});
The Sentry Vite plugin doesn't upload source maps in watch-mode/development-mode. We recommend running a production build to test your implementation.
Other Bundlers
In case you are using a bundler other than Vite to build your Vue
Other Tools
If you're not using any of tools above, we assume you already know how to generate source maps with your toolchain and we recommend you upload them using Sentry CLI.
Though we strongly recommend uploading source maps as part of your build process, for browser applications it's also possible to host your source maps publicly.
Additional Resources
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").
- Package:
- npm:@sentry/vue
- Version:
- 7.72.0
- Repository:
- https://github.com/getsentry/sentry-javascript