- Install @sentry/react and @sentry/vite-plugin - Create instrument.ts with error monitoring, browser tracing (20% prod), and session replay (10% sessions, 100% on errors) - Wire React 19 reactErrorHandler() on createRoot error hooks - Wrap router with wrapCreateBrowserRouterV7 for route-aware transactions - Configure sentryVitePlugin for source map uploads - Add VITE_SENTRY_DSN to .env.example Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { sentryVitePlugin } from '@sentry/vite-plugin'
|
|
import path from 'path'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
sentryVitePlugin({
|
|
org: process.env.SENTRY_ORG,
|
|
project: process.env.SENTRY_PROJECT,
|
|
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
silent: !process.env.SENTRY_AUTH_TOKEN, // Don't error in local dev
|
|
}),
|
|
],
|
|
server: {
|
|
host: '0.0.0.0',
|
|
watch: {
|
|
usePolling: true,
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
test: {
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: './src/test/setup.ts',
|
|
include: ['src/**/*.{test,spec}.{ts,tsx}'],
|
|
},
|
|
build: {
|
|
sourcemap: 'hidden', // Generate source maps but don't expose them publicly
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
// React core and routing
|
|
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
|
|
// Markdown rendering
|
|
'markdown-vendor': ['react-markdown'],
|
|
// State management
|
|
'state-vendor': ['zustand', 'immer', 'zundo'],
|
|
// Icons
|
|
'icons-vendor': ['lucide-react'],
|
|
// Utilities and UI libs
|
|
'utils-vendor': [
|
|
'axios',
|
|
'clsx',
|
|
'tailwind-merge',
|
|
'class-variance-authority',
|
|
'date-fns',
|
|
'sonner',
|
|
],
|
|
// Drag and drop
|
|
'dnd-vendor': [
|
|
'@dnd-kit/core',
|
|
'@dnd-kit/sortable',
|
|
'@dnd-kit/utilities',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
chunkSizeWarningLimit: 500,
|
|
},
|
|
})
|