-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathvite.preload.config.mts
More file actions
35 lines (33 loc) · 1 KB
/
vite.preload.config.mts
File metadata and controls
35 lines (33 loc) · 1 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
import { defineConfig, loadEnv } from 'vite';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import path from 'path';
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}`,
},
}),
]
: [],
resolve: {
alias: {
'@': path.resolve(process.cwd(), './src'),
},
},
build: {
sourcemap: true,
rollupOptions: {
external: ['better-sqlite3', 'keytar'],
},
},
};
});