brackt/vite.config.ts
Chris Parsons 35a3b71579
feat: add Sentry error monitoring (#132)
* feat: add Sentry error monitoring (#77)

Installs and configures @sentry/react-router with server and client
instrumentation. Disabled in development to avoid noise; only active
in production.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: add VSCode Sentry MCP server config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: pass vite env to sentryReactRouter plugin

sentryReactRouter requires the ConfigEnv as a second argument to read
the vite `command` property.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 23:35:33 -07:00

43 lines
1.1 KiB
TypeScript

import { sentryReactRouter } from "@sentry/react-router";
import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default defineConfig((env) => ({
build: {
rollupOptions: env.isSsrBuild
? {
input: "./server/app.ts",
}
: undefined,
},
plugins: [{
name: "database-context-alias",
enforce: "pre" as const,
resolveId(id, _importer, options) {
if (id === "~/database/context") {
return options?.ssr
? path.resolve(__dirname, "database/context.ts")
: path.resolve(__dirname, "database/context.browser-stub.ts");
}
},
}, tailwindcss(), reactRouter(), tsconfigPaths(), sentryReactRouter({
org: "chris-parsons",
project: "brackt",
authToken: process.env.SENTRY_AUTH_TOKEN
}, env)],
server: {
allowedHosts: true,
},
optimizeDeps: {
exclude: ["@sentry/react-router"]
}
}));