diff --git a/scripts/build-web.sh b/scripts/build-web.sh
index 9a06260..8758928 100755
--- a/scripts/build-web.sh
+++ b/scripts/build-web.sh
@@ -102,10 +102,14 @@ rm pkg/evo.js.bak web/pkg/evo.js.bak
# Update cache-busting version in index.html
echo "🔄 Updating cache busting version in index.html..."
sed -i.bak "s/src=\"js\/app\.js?v=[0-9a-f]*\"/src=\"js\/app.js?v=$CACHE_VERSION\"/g" web/index.html
+sed -i.bak "s/src=\"js\/sentry-config\.js?v=[0-9a-z]*\"/src=\"js\/sentry-config.js?v=$CACHE_VERSION\"/g" web/index.html
+sed -i.bak "s/src=\"js\/sentry\.js?v=[0-9a-z]*\"/src=\"js\/sentry.js?v=$CACHE_VERSION\"/g" web/index.html
# Cache-bust the stylesheet too — without a ?v= a stale style.css is served after a deploy.
sed -i.bak "s|href=\"css/style.css?v=[0-9a-z]*\"|href=\"css/style.css?v=$CACHE_VERSION\"|g" web/index.html
rm web/index.html.bak
+node scripts/write-sentry-config.mjs evo web/js/sentry-config.js "$CACHE_VERSION"
+
# Verify the build
echo "🔍 Verifying build..."
if [ -f "pkg/evo.js" ] && [ -f "pkg/evo_bg.wasm" ]; then
@@ -118,4 +122,4 @@ fi
echo "🎉 Build complete! Run 'npm run dev' to start the server."
echo "📁 Built files:"
ls -la pkg/
-echo "🔢 Cache version: $CACHE_VERSION"
\ No newline at end of file
+echo "🔢 Cache version: $CACHE_VERSION"
diff --git a/scripts/write-sentry-config.mjs b/scripts/write-sentry-config.mjs
new file mode 100644
index 0000000..2c7720e
--- /dev/null
+++ b/scripts/write-sentry-config.mjs
@@ -0,0 +1,19 @@
+import { writeFileSync } from 'node:fs';
+
+const app = process.argv[2] || 'evo';
+const target = process.argv[3] || 'web/js/sentry-config.js';
+const fallbackRelease = process.argv[4] || '';
+
+writeFileSync(
+ target,
+ `window.TRE_STATIC_SENTRY_CONFIG = ${JSON.stringify(
+ {
+ app,
+ dsn: process.env.SENTRY_DSN || '',
+ environment: process.env.SENTRY_ENVIRONMENT || 'production',
+ release: process.env.SENTRY_RELEASE || process.env.GITHUB_SHA || fallbackRelease,
+ },
+ null,
+ 2,
+ )};\n`,
+);
diff --git a/web/index.html b/web/index.html
index 0d6605a..74e159b 100644
--- a/web/index.html
+++ b/web/index.html
@@ -178,6 +178,8 @@
+
+