-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
53 lines (50 loc) · 2.07 KB
/
Copy pathvite.config.ts
File metadata and controls
53 lines (50 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite-plus";
import { sentryReactRouter, type SentryReactRouterBuildOptions } from "@sentry/react-router";
const sentryAuthTokenSet = !!process.env.SENTRY_AUTH_TOKEN;
const releaseName = process.env.VERCEL_GIT_COMMIT_SHA ?? process.env.VERSION;
const sentryConfig: SentryReactRouterBuildOptions = {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
// Naming the release here (in addition to passing `release` to
// Sentry.init in instrument.server.mjs / entry.client.tsx) lets the
// build plugin create a proper Release object up-front — unlocking
// commit/PR association, deploy markers, regression detection, and
// "first seen in release" attribution on the Sentry Releases page.
// Symbolication itself works either way thanks to Debug ID matching.
release: releaseName ? { name: releaseName } : undefined,
// Skip source map upload entirely when no auth token is present
// (local dev, CI without secrets, etc.). Without this, the plugin
// logs noisy warnings on every build.
sourcemaps: {
disable: !sentryAuthTokenSet,
},
};
export default defineConfig((config) => ({
resolve: {
tsconfigPaths: true,
},
build: {
sourcemap: true,
},
optimizeDeps: {
exclude: ["react-router-dom"],
},
server: {
watch: {
// 1Password keeps re-syncing `.env`, and Vite restarts the dev server
// on every env-file change (they're explicitly added to the chokidar
// watchlist). Ignore them: env values are read once at startup, and a
// manual dev-server restart picks up changes when actually needed.
ignored: ["**/.env", "**/.env.*"],
},
},
plugins: [tailwindcss(), reactRouter(), sentryReactRouter(sentryConfig, config)],
// Pre-commit checks run via `vp staged` (installed by `vp config`).
// Auto-fix lint + format on staged source files; fixes are re-staged.
staged: {
"*.{js,jsx,ts,tsx,mjs,cjs}": "vp check --fix",
},
}));