ci: add sentryVitePlugin (#6394)

## Summary

This will be used to upload source maps in configured environments.

Docs:
https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/vite/

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6394-ci-add-sentryVitePlugin-29c6d73d365081239f48f2fd261736d5)
by [Unito](https://www.unito.io)
This commit is contained in:
Arjan Singh
2025-10-30 10:28:48 -07:00
committed by GitHub
parent dd90288846
commit 04eb224822
4 changed files with 248 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import { sentryVitePlugin } from '@sentry/vite-plugin'
import tailwindcss from '@tailwindcss/vite'
import vue from '@vitejs/plugin-vue'
import { config as dotenvConfig } from 'dotenv'
@@ -289,6 +290,27 @@ export default defineConfig({
template: 'treemap' // or 'sunburst', 'network'
})
]
: []),
// Sentry sourcemap upload plugin
// Only runs during cloud production builds when all Sentry env vars are present
// Requires: SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT env vars
...(DISTRIBUTION === 'cloud' &&
process.env.SENTRY_AUTH_TOKEN &&
process.env.SENTRY_ORG &&
process.env.SENTRY_PROJECT &&
!IS_DEV
? [
sentryVitePlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
sourcemaps: {
// Delete source maps after upload to prevent public access
filesToDeleteAfterUpload: ['**/*.map']
}
})
]
: [])
],