Vite plugin acting as an interface to SentryCLI





GitHub Stars



Last Commit

6mos ago






Size (min+gzip)




Type Definitions





Plugin to integrate Vite ⚡️ with Sentry

Version License: MIT Twitter: realtominoff

Vite plugin acts as interface to SentryCLI

Support Richard M. Stallman

It's a port of official Sentry webpack plugin for Vite.

It's fully written on Typescript and there is some differences in configuration, described below.


yarn add vite-plugin-sentry


If you using Typescript - you can use ViteSentryPluginOptions type for better configuration experience with autocomplete.

Example config:

// vite.config.ts
// other declarations
import type { ViteSentryPluginOptions } from 'vite-plugin-sentry'
import viteSentry from 'vite-plugin-sentry'

    Configure sentry plugin
const sentryConfig: ViteSentryPluginOptions = {
  url: 'https://my.ondemand.sentry.com',
  authToken: '<SECRET_TOKEN_HERE>',
  org: 'my_org',
  project: 'my_project',
  release: '1.0',
  deploy: {
    env: 'production'
  setCommits: {
    auto: true
  sourceMaps: {
    include: ['./dist/assets'],
    ignore: ['node_modules'],
    urlPrefix: '~/assets'

export default defineConfig({
  // other options
  plugins: [ viteSentry(sentryConfig) ]

Here are the list of all plugin options:

OptionTypeRequiredDefault valueDescription
debugbooleanfalseShow debug messages during run
dryRunbooleanfalseRun sentry in dry mode - will only prints all steps
urlstring'https://sentry.io/'The base URL of your Sentry instance.
authTokenstring''The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: project:releases (and org:read if setCommits option is used).
orgstring''The slug of the Sentry organization associated with the app.
projectstring''The slug of the Sentry project associated with the app.
vcsRemotestring'origin'The name of the remote in the version control system.
configFilestring''Path to sentry cli config file, as described in https://docs.sentry.io/product/cli/configuration/#configuration-file. By default, the config file is looked for upwards from the current path, and defaults from ~/.sentryclirc are always loaded
releasestringUnique name for release. Defaults to sentry-cli releases propose version (requires access to GIT and root directory to be repo)
finalizebooleanfalseDetermines whether processed release should be automatically finalized after artifacts upload
silentbooleanfalseIf true, all sentry-cli logs are suppressed
deploySentryCliNewDeployOptionsSentry release deployment settings, see details below
sourceMapsSentryCliUploadSourceMapsOptionsSourcemaps settings, see details below
setCommitsSentryCliCommitsOptionsAdds commits to sentry, see details below

deploy settings

With deploy you can configure sentry cli to send deployment info. Here is a table of settings:

envstringEnvironment value for release. For example production
startednumberUNIX timestamp for deployment start
finishednumberUNIX timestamp for deployment finish
timenumberDeployment duration in seconds. Can be used instead of started and finished.
namestringHuman-readable name for this deployment
urlstringURL that points to the deployment

sourceMaps settings

With sourceMaps you can configure how sourcemaps will be processed

includestring | string[]One or more paths that Sentry CLI should scan recursively for sources. It will upload all .map files and match associated .js files.
ignorestring[]Paths to ignore during upload. Overrides entries in ignoreFile file. If neither ignoreFile nor ignore is present, defaults to ['node_modules'].
ignoreFilestringPath to a file containing list of files/directories to ignore. Can point to .gitignore or anything with the same format.
rewritebooleanEnables rewriting of matching source maps so that indexed maps are flattened and missing sources are inlined if possible. Defaults to true
sourceMapReferencebooleanPrevents the automatic detection of sourcemap references. Defaults to false.
stripPrefixstring[]When paired with rewrite, will remove a prefix from uploaded filenames. Useful for removing a path that is build-machine-specific.
stripCommonPrefixbooleanWhen paired with rewrite, will add ~ to the stripPrefix array. Defaults to false
validatebooleanWhen true, attempts source map validation before upload if rewriting is not enabled. It will spot a variety of issues with source maps and cancel the upload if any are found. Defaults to false to prevent false positives canceling upload.
urlPrefixstringURL prefix to add to the beginning of all filenames. Defaults to ~/ but you might want to set this to the full URL. This is also useful if your files are stored in a sub folder. eg: url-prefix '~/static/js'.
urlSuffixstringURL suffix to add to the end of all filenames. Useful for appending query parameters.
extstring[]The file extensions to be considered. By default the following file extensions are processed: js, map, jsbundle, and bundle.

setCommits settings

With setCommits you can configure

repostringif auto === falseThe full git repo name as defined in Sentry. Required if auto option is not true, otherwise optional.
commitstringif auto === falseThe current (most recent) commit in the release. Required if auto option is not true, otherwise optional.
previousCommitstringThe last commit of the previous release. Defaults to the most recent commit of the previous release in Sentry, or if no previous release is found, 10 commits back from commit.
autobooleanAutomatically set commit and previousCommit. Defaults commit to HEAD and previousCommit as described above. Overrides other options


There are no tests at the moment, because i'm not sure how to test it 😔 If you have ideas - please, make issue or PR. 👍


👤 ikenfin

Show your support

Give a ⭐️ if this project helped you!

This README was generated with ❤️ by readme-md-generator

Rate & Review

Great Documentation0
Easy to Use0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Unwelcoming Community0