Sentry config

This commit is contained in:
Natsumi
2025-09-18 19:42:41 +12:00
parent 5d0c6c4141
commit 0916bdcacd
4 changed files with 21 additions and 8 deletions

View File

@@ -122,7 +122,6 @@ jobs:
run: npm ci run: npm ci
- name: Build Cef-html - name: Build Cef-html
env: env:
SENTRY_URL: ${{ secrets.SentryUrl }}
SENTRY_AUTH_TOKEN: ${{ secrets.SentryAuthToken }} SENTRY_AUTH_TOKEN: ${{ secrets.SentryAuthToken }}
run: npm run prod run: npm run prod
- name: Upload Cef-html artifacts - name: Upload Cef-html artifacts

View File

@@ -20,7 +20,7 @@ app.use(pinia);
app.use(i18n); app.use(i18n);
app.use(ElementPlus); app.use(ElementPlus);
initComponents(app); initComponents(app);
initSentry(app); await initSentry(app);
app.mount('#root'); app.mount('#root');

View File

@@ -34,6 +34,7 @@ export async function initSentry(app) {
app, app,
dsn, dsn,
environment: 'nightly', environment: 'nightly',
release: version,
replaysSessionSampleRate: 0.1, replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0, replaysOnErrorSampleRate: 1.0,
beforeSend(event, hint) { beforeSend(event, hint) {

View File

@@ -3,22 +3,35 @@ import vue from '@vitejs/plugin-vue';
import { sentryVitePlugin } from '@sentry/vite-plugin'; import { sentryVitePlugin } from '@sentry/vite-plugin';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path'; import { dirname, resolve } from 'node:path';
import fs from 'node:fs';
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
const url = process.env.SENTRY_URL;
const authToken = process.env.SENTRY_AUTH_TOKEN; const authToken = process.env.SENTRY_AUTH_TOKEN;
const buildAndUploadSourceMaps = authToken ? true : false;
const vrcxVersion = fs
.readFileSync(resolve(__dirname, '../Version'), 'utf-8')
.trim();
if (buildAndUploadSourceMaps) {
console.log('Source maps will be built and uploaded to Sentry');
}
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig(() => ({ export default defineConfig(() => ({
base: '', base: '',
plugins: [ plugins: [
vue(), vue(),
url && buildAndUploadSourceMaps &&
sentryVitePlugin({ sentryVitePlugin({
url,
authToken, authToken,
org: 'vrcx', project: 'vrcx-web',
project: 'vrcx-web' release: {
name: vrcxVersion
},
sourcemaps: {
assets: './build/html/**',
filesToDeleteAfterUpload: './build/html/**/*.js.map'
}
}) })
], ],
define: { define: {
@@ -42,6 +55,6 @@ export default defineConfig(() => ({
vr: resolve(__dirname, 'vr.html') vr: resolve(__dirname, 'vr.html')
} }
}, },
sourcemap: true sourcemap: buildAndUploadSourceMaps
} }
})); }));