Registry / observability / vite-plugin-sentry

vite-plugin-sentry

JSON →
library1.4.1jsnpmunverified

Unofficial Sentry plugin for Vite that creates releases and uploads sourcemaps during the Vite build process, using @sentry/cli. Version 1.4.1 supports Vite 2.6–6.x and Node >=14. Built on TypeScript with full type definitions. Unlike the official webpack plugin, it offers virtual module integration to share release/dist config with the Sentry client, and optional automatic commit tracking and deployment environment configuration. Known for breaking changes in error handling (1.2.0) and deprecation of virtual module paths (1.1.5).

npm install vite-plugin-sentry
INSTALL
IMPORT
SIG · VITE-PLUGIN-SENTRY
V
vite-plugin-sentry
observabilityjavascriptv1.4.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

viteSentry
import viteSentry from 'vite-plugin-sentry'
const viteSentry = require('vite-plugin-sentry')
Default export for the plugin function. ESM-only since v1.1.6; CommonJS require may fail.
ViteSentryPluginOptions
import type { ViteSentryPluginOptions } from 'vite-plugin-sentry'
import { ViteSentryPluginOptions } from 'vite-plugin-sentry'
TypeScript type import; do not use runtime import as it will be undefined in JS. Available since v1.1.0.
virtual:vite-plugin-sentry/sentry-config
import 'virtual:vite-plugin-sentry/sentry-config'
import config from 'virtual:vite-plugin-sentry/sentry-release'
Use virtual module to expose release/dist. The old path 'sentry-release' was deprecated in v1.1.5 and removed later.

Shows Vite config with vite-plugin-sentry, including auth token from env, sourcemaps, commit tracking, and deployment environment.

import { defineConfig } from 'vite'; import viteSentry from 'vite-plugin-sentry'; export default defineConfig({ plugins: [ viteSentry({ url: 'https://sentry.io', authToken: process.env.SENTRY_AUTH_TOKEN ?? '', org: 'my_org', project: 'my_project', release: '1.0', deploy: { env: 'production' }, setCommits: { auto: true }, sourceMaps: { include: ['./dist/assets'], ignore: ['node_modules'], urlPrefix: '~/assets' } }) ], build: { sourcemap: true } });
Debug
Known issues
breakingSince v1.2.0, Sentry upload errors crash the build instead of printing warnings. Use legacyErrorHandlingMode: true to revert.
fix
Add legacyErrorHandlingMode: true to plugin options.
affects: >=1.2.0
deprecatedVirtual module path 'virtual:vite-plugin-sentry/sentry-release' is deprecated since v1.1.5 and may be removed. Use 'virtual:vite-plugin-sentry/sentry-config' instead.
fix
Replace 'sentry-release' with 'sentry-config' in imports.
affects: >=1.1.5
gotchaPlugin requires build.sourcemap: true in Vite config to generate sourcemaps for upload. Missing this will cause no sourcemaps to be uploaded.
fix
Add sourcemap: true to Vite build options.
affects: all
gotchaIn TypeScript, you must add 'vite-plugin-sentry/client' to tsconfig types or use a reference directive to get types for the virtual module and import.meta.env.
fix
Add "types": ["vite-plugin-sentry/client"] in tsconfig.json.
affects: >=1.1.0
gotchaFrom v1.1.6, the package uses .mjs for module entry and supports both ESM and CJS via conditional exports. CommonJS require() may not work in older Node versions (<14).
fix
Use import or upgrade Node to >=14.
affects: >=1.1.6
Errors
Common errors & fixes
Error: Could not read auth token. Run 'sentry-cli login' or set the SENTRY_AUTH_TOKEN environment variable.
Missing or invalid authToken in config or environment.
fix
Set authToken in plugin options or export SENTRY_AUTH_TOKEN environment variable.
[vite-plugin-sentry] Sourcemaps upload failed: HTTP 403 Forbidden
Sentry auth token lacks permissions (project:write or org:integrations).
fix
Generate a new auth token in Sentry with 'project:write' and 'org:integrations' scopes.
Uncaught TypeError: Cannot read properties of undefined (reading 'dist')
Virtual module 'virtual:vite-plugin-sentry/sentry-config' not imported before accessing import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.
fix
Ensure import 'virtual:vite-plugin-sentry/sentry-config' is at the top of your entry file.
Cannot find module 'vite-plugin-sentry' or its corresponding type declarations.
Missing or mismatched package installation; or TypeScript cannot resolve types.
fix
Install vite-plugin-sentry as a dev dependency: npm install -D vite-plugin-sentry. Ensure tsconfig.json includes node_modules in typeRoots.
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies
viterequiredPeer dependency; plugin hooks into Vite's build process.
Agent activity
48 hits · last 30 days
node
42
OpenAI (training)
1
Resources
vite-plugin-sentry — npm install vite-plugin-sentry · libregistry