feat: add vite-plugin sentry
This commit is contained in:

committed by
kolaente

parent
389ca1b692
commit
73947f0ba4
@ -4,7 +4,7 @@ import type {ConfigurableWindow} from '@vueuse/core'
|
||||
|
||||
export function useOnline(options?: ConfigurableWindow) {
|
||||
const isOnline = useNetworkOnline(options)
|
||||
const fakeOnlineState = !!import.meta.env.VITE_IS_ONLINE
|
||||
const fakeOnlineState = Boolean(import.meta.env.VITE_IS_ONLINE)
|
||||
if (isOnline.value === false && fakeOnlineState) {
|
||||
console.log('Setting fake online state', fakeOnlineState)
|
||||
return ref(true)
|
||||
|
@ -4,9 +4,8 @@ import {createApp} from 'vue'
|
||||
import pinia from './pinia'
|
||||
import router from './router'
|
||||
import App from './App.vue'
|
||||
|
||||
import {setupSentry} from './sentry'
|
||||
import {error, success} from './message'
|
||||
|
||||
import {VERSION} from './version.json'
|
||||
|
||||
// Notifications
|
||||
@ -106,8 +105,12 @@ setLanguage(browserLanguage).then(() => {
|
||||
}
|
||||
|
||||
if (window.SENTRY_ENABLED) {
|
||||
import('./sentry').then(sentry => sentry.default(app, router))
|
||||
try{
|
||||
setupSentry(app, router)
|
||||
} catch(e) {
|
||||
console.error('Could not enable Sentry tracking', e)
|
||||
}
|
||||
}
|
||||
|
||||
app.use(pinia)
|
||||
app.use(router)
|
||||
|
@ -1,15 +1,16 @@
|
||||
import type { App } from 'vue'
|
||||
import type { Router } from 'vue-router'
|
||||
import {VERSION} from './version.json'
|
||||
import 'virtual:vite-plugin-sentry/sentry-config'
|
||||
import type {App} from 'vue'
|
||||
import type {Router} from 'vue-router'
|
||||
|
||||
export default async function setupSentry(app: App, router: Router) {
|
||||
export async function setupSentry(app: App, router: Router) {
|
||||
const Sentry = await import('@sentry/vue')
|
||||
const {Integrations} = await import('@sentry/tracing')
|
||||
|
||||
Sentry.init({
|
||||
release: VERSION,
|
||||
app,
|
||||
dsn: window.SENTRY_DSN,
|
||||
release: import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.release,
|
||||
dist: import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.dist,
|
||||
integrations: [
|
||||
new Integrations.BrowserTracing({
|
||||
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
|
||||
|
Reference in New Issue
Block a user