-
Notifications
You must be signed in to change notification settings - Fork 3
/
vite.config.mjs
69 lines (65 loc) · 1.62 KB
/
vite.config.mjs
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
import { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react";
import { defineConfig, loadEnv } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const enableSentrySourcemaps = env.SENTRY_AUTH_TOKEN && env.SENTRY_PROJECT;
return {
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
chart: ["react-chartjs-2", "chart.js", "chartjs-adapter-luxon"],
vendor: [
"@github/webauthn-json",
"@sentry/react",
"@stripe/react-stripe-js",
"@stripe/stripe-js",
"classnames",
"debug",
"react",
"react-dom",
"react-router",
"react-router-dom",
"starfx",
"qrcode.react",
],
},
},
},
},
plugins: [
react(),
tsconfigPaths(),
...(
enableSentrySourcemaps
? [
sentryVitePlugin({
authToken: env.SENTRY_AUTH_TOKEN,
org: env.SENTRY_ORG || "aptible",
project: env.SENTRY_PROJECT,
}),
]
: []
),
],
server: {
port: 4200,
},
preview: {
port: 4200,
},
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./src/test/setup.ts"],
reporters: ["basic"],
env: {
NODE_OPTIONS: "--no-experimental-fetch",
},
},
};
});