-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mts
66 lines (63 loc) · 1.59 KB
/
vite.config.mts
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
import { sentryVitePlugin as sentry } from "@sentry/vite-plugin";
import spotlightSidecar from "@spotlightjs/sidecar/vite-plugin";
import react from "@vitejs/plugin-react";
import path from "node:path";
import { defineConfig, loadEnv } from "vite";
import tsconfig from "./tsconfig.json";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
build: {
manifest: true,
outDir: path.resolve(__dirname, "dist/client"),
sourcemap: true,
},
clearScreen: false,
define: {
"process.env.LOGTAIL_TOKEN": JSON.stringify(env.LOGTAIL_TOKEN ?? ""),
"process.env.NODE_ENV": JSON.stringify(mode ?? ""),
"process.env.SENTRY_DSN": JSON.stringify(env.SENTRY_DSN ?? ""),
},
plugins: [
sentry({
authToken: env.SENTRY_AUTH_TOKEN,
org: env.SENTRY_ORG,
project: env.SENTRY_PROJECT,
telemetry: false,
}),
spotlightSidecar(),
react(),
],
resolve: {
alias: Object.entries(tsconfig.compilerOptions.paths).reduce(
(alias, [k, a]) => ({
...alias,
[k.replace(/\/\*$/, "")]: a.map((v) =>
path.resolve(__dirname, v.replace(/\/\*$/, "")),
),
}),
{},
),
},
server: {
proxy: {
"/api": {
changeOrigin: true,
secure: false,
target: `http://localhost:${env.PORT_SERVER}`,
},
},
port: Number.parseInt(env.PORT_CLIENT),
strictPort: true,
},
test: {
environment: "node",
environmentMatchGlobs: [
["src/client/**/*.test.tsx", "happy-dom"],
["src/server/**/*.test.ts", "node"],
],
exclude: ["node_modules", "dist", "./src/e2e"],
watch: false,
},
};
});