// vite.config.ts import { defineConfig } from "vite"; import { tanstackStart } from "@tanstack/react-start/plugin/vite"; import viteReact from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; import { sentryTanstackStart } from "@sentry/tanstackstart-react/vite"; /** * Sentry build-time integration (sourcemap generation + upload) only runs * when SENTRY_AUTH_TOKEN is present — local and CI builds without * credentials are completely unaffected. */ const sentryUpload = Boolean(process.env.SENTRY_AUTH_TOKEN); export default defineConfig({ server: { port: 3000, }, resolve: { tsconfigPaths: true, }, ...(sentryUpload ? { build: { sourcemap: true } } : {}), plugins: [ tailwindcss(), tanstackStart({ srcDirectory: "src", // This is the default router: { // Specifies the directory TanStack Router uses for your routes. routesDirectory: "app", // Defaults to "routes", relative to srcDirectory }, }), viteReact(), ...(sentryUpload ? [ sentryTanstackStart({ sourcemaps: { filesToDeleteAfterUpload: ["dist/**/*.map"] }, }), ] : []), ], });