- vite.renderer.config: remove deprecated babel option from @vitejs/plugin-react v6 - server/main.ts: cast fastify instance to fix version mismatch TS error - proxy-tool-streaming.test: pass 3 args to ProxyService constructor (added TokenUsageService mock) - input.test: update expected classes (rounded-lg, bg-muted/50) - StatCard.test: update selectors and accent classes to match component (rounded-lg, /8 opacity, bg-white/[0.04]) - paths.test: relax executable path assertion for CI environments - cloud-repo.test: add fs mock to prevent EACCES on /mock/db - cloudHandler-sync.test: add traffic-logger mock to prevent EACCES on /mock/
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
|
import path from 'path';
|
|
import { codeInspectorPlugin } from 'code-inspector-plugin';
|
|
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '');
|
|
const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN || env.SENTRY_AUTH_TOKEN;
|
|
const shouldEnableSentry = mode === 'production' && Boolean(sentryAuthToken);
|
|
|
|
return {
|
|
plugins: [
|
|
...(shouldEnableSentry
|
|
? [
|
|
sentryVitePlugin({
|
|
org: process.env.SENTRY_ORG || env.SENTRY_ORG,
|
|
project: process.env.SENTRY_PROJECT || env.SENTRY_PROJECT,
|
|
authToken: sentryAuthToken,
|
|
release: {
|
|
name: `${process.env.npm_package_name}@${process.env.npm_package_version}`,
|
|
},
|
|
// Electron loads files from app://, so we need to normalize paths for Source Map matching
|
|
sourcemaps: {
|
|
// Rewrite the source paths to strip the Electron app:// protocol
|
|
rewriteSources: (source) => {
|
|
// Transform: app:///.vite/renderer/main_window/assets/index.js
|
|
// Into: ~/.vite/renderer/main_window/assets/index.js
|
|
return source.replace(/^app:\/\/\//, '~/');
|
|
},
|
|
},
|
|
}),
|
|
]
|
|
: []),
|
|
tanstackRouter({
|
|
target: 'react',
|
|
autoCodeSplitting: true,
|
|
}),
|
|
tailwindcss(),
|
|
react(),
|
|
codeInspectorPlugin({ bundler: 'vite' }),
|
|
],
|
|
optimizeDeps: {
|
|
entries: ['index.html'],
|
|
},
|
|
define: {
|
|
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN || env.SENTRY_DSN),
|
|
},
|
|
resolve: {
|
|
preserveSymlinks: true,
|
|
alias: {
|
|
'@': path.resolve(process.cwd(), './src'),
|
|
},
|
|
},
|
|
};
|
|
});
|