-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathvite.config.ts
More file actions
82 lines (80 loc) · 2.19 KB
/
vite.config.ts
File metadata and controls
82 lines (80 loc) · 2.19 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import {defineConfig} from 'vite';
import react from '@vitejs/plugin-react';
import {TanStackRouterVite} from '@tanstack/router-vite-plugin';
import {sentryVitePlugin} from '@sentry/vite-plugin';
import {execSync} from 'child_process';
import type {UserConfig} from 'vite';
const version = execSync('git describe --always --tags', {encoding: 'utf8'}).trim();
const gitBranch = execSync('git rev-parse --abbrev-ref HEAD', {encoding: 'utf8'}).trim();
const buildTime = new Date().toISOString();
export default defineConfig(
({}): UserConfig => ({
define: {
'import.meta.env.VITE_APP_VERSION': JSON.stringify(version),
'import.meta.env.VITE_GIT_BRANCH': JSON.stringify(gitBranch),
'import.meta.env.VITE_BUILD_TIME': JSON.stringify(buildTime),
},
plugins: [
TanStackRouterVite({
routeFilePrefix: '',
routesDirectory: './src/routes',
generatedRouteTree: './src/routeTree.gen.ts',
disableTypes: false,
autoCodeSplitting: true,
}),
react(),
...(process.env.SENTRY_AUTH_TOKEN && process.env.SENTRY_ORG && process.env.SENTRY_PROJECT
? [
sentryVitePlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: version,
setCommits: {
auto: true,
},
...((process.env.SENTRY_ENVIRONMENT === 'production-firebase' ||
process.env.SENTRY_ENVIRONMENT === 'production-cloudflare') && {
deploy: {
env: process.env.SENTRY_ENVIRONMENT,
},
}),
},
sourcemaps: {
assets: './dist/**',
filesToDeleteAfterUpload: ['./dist/**/*.map'],
},
}),
]
: []),
],
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks: (id: string) => {
if (id.includes('entitiesWithIcons')) return 'entities';
return undefined;
},
},
},
},
publicDir: 'public',
server: {
port: 3000,
proxy: {
'/api': 'http://localhost:8080',
},
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
alias: {
src: '/src',
},
},
optimizeDeps: {
include: ['@fortawesome/fontawesome-svg-core'],
},
}),
);