From 3895f0a6c3f8bbea42e7456cb5e24f512a680a94 Mon Sep 17 00:00:00 2001 From: Francisco Ramos Date: Tue, 13 Jun 2023 04:12:39 +0200 Subject: [PATCH] chore(bridge-ui): uploading source maps to Sentry (#13974) --- .../Transactions/Transaction.svelte | 2 +- packages/bridge-ui/src/sentry.ts | 8 +++++--- packages/bridge-ui/vite.config.ts | 20 +++++++++++-------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/bridge-ui/src/components/Transactions/Transaction.svelte b/packages/bridge-ui/src/components/Transactions/Transaction.svelte index 50e85213759..00e0045eb21 100644 --- a/packages/bridge-ui/src/components/Transactions/Transaction.svelte +++ b/packages/bridge-ui/src/components/Transactions/Transaction.svelte @@ -11,7 +11,7 @@ import { chains } from '../../chain/chains'; import { bridgeABI } from '../../constants/abi'; import { BridgeType } from '../../domain/bridge'; - import type { Chain, ChainID } from '../../domain/chain'; + import type { ChainID } from '../../domain/chain'; import { MessageStatus } from '../../domain/message'; import type { NoticeOpenArgs } from '../../domain/modal'; import { diff --git a/packages/bridge-ui/src/sentry.ts b/packages/bridge-ui/src/sentry.ts index f8dcb3ef7a6..3c49ae8492a 100644 --- a/packages/bridge-ui/src/sentry.ts +++ b/packages/bridge-ui/src/sentry.ts @@ -12,15 +12,17 @@ const environment = const isProd = environment === 'production'; -export function setupSentry(dsn: string) { +export function setupSentry(dsn?: string) { + if (!dsn) return; + Sentry.init({ dsn, environment, integrations: [new Sentry.BrowserTracing()], - sampleRate: isProd ? 0.6 : 1.0, - tracesSampleRate: isProd ? 0.6 : 1.0, + sampleRate: isProd ? 0.2 : 1.0, + tracesSampleRate: isProd ? 0.2 : 1.0, maxBreadcrumbs: 50, beforeSend(event, hint) { diff --git a/packages/bridge-ui/vite.config.ts b/packages/bridge-ui/vite.config.ts index e42c9243c51..6b3370148a0 100644 --- a/packages/bridge-ui/vite.config.ts +++ b/packages/bridge-ui/vite.config.ts @@ -1,14 +1,18 @@ +import { sentryVitePlugin } from '@sentry/vite-plugin'; import { svelte } from '@sveltejs/vite-plugin-svelte'; import polyfillNode from 'rollup-plugin-polyfill-node'; import { defineConfig } from 'vite'; -// https://vitejs.dev/config/ export default defineConfig({ - define: { - global: 'globalThis', - 'process.env.NODE_DEBUG': false, - 'process.env.LINK_API_URL': false, - 'process.env.SDK_VERSION': "'unknown'", - }, - plugins: [svelte(), polyfillNode()], + build: { sourcemap: true }, + define: { global: 'globalThis' }, + plugins: [ + svelte(), + polyfillNode(), + sentryVitePlugin({ + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, + authToken: process.env.SENTRY_AUTH_TOKEN, + }), + ], });