-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
82 lines (80 loc) · 2.24 KB
/
vite.config.ts
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 { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import { checker } from "vite-plugin-checker";
import { nodePolyfills } from "vite-plugin-node-polyfills";
// import removeConsole from "vite-plugin-remove-console";
import svgr from "vite-plugin-svgr";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig(({ mode }) => {
const isProd = mode === "production";
const isDev = mode === "development";
return {
build: {
sourcemap: true,
},
plugins: [
react(),
svgr(),
tsconfigPaths(),
nodePolyfills(),
// isProd && removeConsole(),
isDev &&
checker({
eslint: {
lintCommand: 'eslint "./src/**/*.{ts,tsx}"',
},
overlay: {
initialIsOpen: false,
},
typescript: true,
}),
sentryVitePlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "occamfi",
project: "swissborg-data-guardian",
}),
],
server: {
port: 8080,
proxy: {
"/api": {
secure: false,
target: "https://api-stage-swissborg.galactica.com",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
configure: (proxy, _options) => {
proxy.on("error", (err, _req, _res) => {
console.log("proxy error", err);
});
proxy.on("proxyReq", (proxyReq, req, _res) => {
console.log(
"Sending Request to the Target:",
req.method,
req.url
);
});
proxy.on("proxyRes", (proxyRes, req, _res) => {
console.log(
"Received Response from the Target:",
proxyRes.statusCode,
req.url
);
});
},
},
},
},
resolve: {
alias: process.env.PROFILER
? [
{ find: /^react-dom$/, replacement: "react-dom/profiling" },
{
find: "scheduler/tracing",
replacement: "scheduler/tracing-profiling",
},
]
: [],
},
};
});