From ab51388506f7b48528b512dde3f5cbb3e098b7f7 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Fri, 22 Nov 2024 13:26:42 -0300 Subject: [PATCH] sentry: Configure `vite` to pass source maps to Sentry automatically Those source maps are used by Sentry to unminify code and allow better stack tracing inside it. --- .gitignore | 5 ++++- vite.config.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 86cb87e67..671a37d53 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ cypress/fixtures/ cypress/videos/ cypress/screenshots/ -*.log \ No newline at end of file +*.log + +# Sentry Config File +.env.sentry-build-plugin diff --git a/vite.config.ts b/vite.config.ts index 7def5da23..503f87a72 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,3 +1,4 @@ +import { sentryVitePlugin } from '@sentry/vite-plugin' import vue from '@vitejs/plugin-vue' import path from 'path' import { defineConfig } from 'vite' @@ -12,6 +13,9 @@ const isElectron = process.env.ELECTRON === 'true' const isBuilding = process.argv.includes('build') export default defineConfig({ + build: { + sourcemap: true, + }, plugins: [ (isElectron || isBuilding) && electron({ @@ -30,6 +34,11 @@ export default defineConfig({ startup() }, }), + sentryVitePlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: 'blue-robotics-c7', + project: 'cockpit-frontend-production', + }), vue(), vuetify({ autoImport: true,