-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
70 lines (67 loc) · 1.94 KB
/
vite.config.ts
File metadata and controls
70 lines (67 loc) · 1.94 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
import babel from '@rolldown/plugin-babel';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import tailwindcss from '@tailwindcss/vite';
import react, { reactCompilerPreset } from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
const sentryOrg = process.env.SENTRY_ORG;
const sentryProject = process.env.SENTRY_PROJECT;
const sentryAuthToken = process.env.SENTRY_AUTH_TOKEN;
const sentryRelease = process.env.SENTRY_RELEASE;
const shouldAnalyzeBundle = process.env.ANALYZE === 'true';
const shouldUploadSourcemaps = Boolean(sentryOrg && sentryProject && sentryAuthToken);
// https://vite.dev/config/
export default defineConfig({
build: {
// Preserve the Vite 7 browser baseline until we intentionally drop older WebViews.
target: ['chrome107', 'edge107', 'firefox104', 'safari16'],
rolldownOptions: {
plugins: shouldAnalyzeBundle
? [
visualizer({
brotliSize: true,
filename: 'docs/perf/assets/bundle-stats.html',
gzipSize: true,
open: false,
template: 'treemap',
}),
]
: [],
},
sourcemap: shouldUploadSourcemaps ? 'hidden' : false,
},
plugins: [
react(),
babel({
presets: [reactCompilerPreset()],
}),
tailwindcss(),
svgr({ include: '**/*.svg' }),
...(shouldUploadSourcemaps
? [
sentryVitePlugin({
org: sentryOrg,
project: sentryProject,
authToken: sentryAuthToken,
telemetry: false,
release: sentryRelease ? { name: sentryRelease } : undefined,
sourcemaps: {
filesToDeleteAfterUpload: ['dist/**/*.map'],
},
}),
]
: []),
],
resolve: {
alias: {
'@': '/src',
},
},
server: {
port: 3000,
},
preview: {
port: 3000,
},
});