diff --git a/site/source/api/sentry.ts b/site/source/api/sentry.ts index 15c8d7eba..24c6dd6bd 100644 --- a/site/source/api/sentry.ts +++ b/site/source/api/sentry.ts @@ -22,6 +22,7 @@ if (BRANCH_NAME && IS_STAGING) { if (!import.meta.env.SSR && (IS_PRODUCTION || IS_STAGING)) { init({ + release: SENTRY_RELEASE_NAME, dsn: 'https://d857393f4cfb40eebc0b9b54893bab23@sentry.incubateur.net/9', integrations: [ new CaptureConsole({ levels: ['error'] }), diff --git a/site/source/types/app-env.d.ts b/site/source/types/app-env.d.ts index 0b76c1073..394471e00 100644 --- a/site/source/types/app-env.d.ts +++ b/site/source/types/app-env.d.ts @@ -52,3 +52,8 @@ declare const IS_STAGING: boolean * This variable is statically replaced during the build */ declare const IS_DEVELOPMENT: boolean + +/** + * This variable is statically replaced during the build + */ +declare const SENTRY_RELEASE_NAME: string diff --git a/site/vite.config.ts b/site/vite.config.ts index 9c981cf8f..e255a9129 100644 --- a/site/vite.config.ts +++ b/site/vite.config.ts @@ -55,6 +55,7 @@ export default defineConfig(({ command, mode }) => ({ IS_DEVELOPMENT: mode === 'development', IS_STAGING: mode === 'production' && !isProductionBranch(mode), IS_PRODUCTION: mode === 'production' && isProductionBranch(mode), + SENTRY_RELEASE_NAME: JSON.stringify(sentryReleaseName(mode)), }, plugins: [ command === 'build' && @@ -109,6 +110,7 @@ export default defineConfig(({ command, mode }) => ({ release: { // Use same release name as the one used in the app. name: sentryReleaseName(mode), + inject: false, // Avoid adding imports with a hash in chunks, as this causes long term caching issues. uploadLegacySourcemaps: { paths: ['./dist'], ignore: ['./node_modules'],