Files
sase.tr/apps/web/vite.config.ts
Süper Panel 9f3eb0ff86
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
feat(observability): browser Sentry SDK (gated on VITE_SENTRY_DSN)
Sase frontend has Faro (RUM) and PostHog (product analytics) but no browser
error monitoring. A recent panel session investigation (panel insight
cmpv9q3ms004dfcphluw0z8bh — silent rage-clicks after parts_panel_viewed
with no API call) couldn't be confirmed or refuted from JS error data
because there was no JS error channel at all. This adds one.

- @sentry/react ^9 (dynamic import in lib/sentry.ts so the bundle only
  pays the SDK cost when DSN is configured)
- Init is gated on VITE_SENTRY_DSN — unset = no-op, no behaviour change
- Replay only fires on error (sessionSampleRate 0, onErrorSampleRate 1)
- KVKK: sendDefaultPii false, maskAllText + blockAllMedia on replay
- Builds emit hidden source maps so Sentry can de-minify traces while
  end users don't fetch the maps in the browser
- docker-compose.coolify.yml threads VITE_SENTRY_* through as build args
  (VITE_* must be build-time; runtime env never reaches a Vite bundle)

Wiring on the Coolify side is a separate manual step — set
VITE_SENTRY_DSN on the prod (ro48g…) and/or dev (jwgwkg…) app and
redeploy. Backend Sentry (NestJS) is unchanged.

Refs: Süper Panel docs/ARCHITECTURE.md, panel sentry-archive job.
2026-06-01 18:13:13 +03:00

39 lines
981 B
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { TanStackRouterVite } from "@tanstack/router-plugin/vite";
import path from "node:path";
export default defineConfig({
plugins: [
TanStackRouterVite({
routesDirectory: "./src/routes",
generatedRouteTree: "./src/routeTree.gen.ts",
quoteStyle: "double",
}),
react(),
tailwindcss(),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
port: 3000,
proxy: {
"/api": {
target: "http://localhost:4000",
changeOrigin: true,
},
},
},
build: {
outDir: "dist",
// 'hidden' emits source maps but strips the //# sourceMappingURL comment
// from JS bundles. Sentry can still consume them (via release upload), but
// browsers won't fetch them, so end-user stack traces stay minified.
sourcemap: "hidden",
},
});