Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
70 lines (67 loc) · 1.69 KB
/
Copy pathvite.config.ts
File metadata and controls
70 lines (67 loc) · 1.69 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 { sentryVitePlugin } from "@sentry/vite-plugin";
import react from "@vitejs/plugin-react";
import path from "path";
import { defineConfig, loadEnv } from "vite";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import svgr from "vite-plugin-svgr";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
if (!env.VITE_SSV_NETWORKS) {
console.error("VITE_SSV_NETWORKS is not defined in .env");
}
return {
worker: {
format: "es",
},
build: {
target: "es2022",
outDir: "build",
sourcemap: true,
rollupOptions: {
output: {
sourcemapExcludeSources: true, // Ignore sources in node_modules
},
},
},
server: {
port: 3000,
open: true,
},
plugins: [
react({
babel: {
plugins: [["module:@preact/signals-react-transform"]],
},
}),
nodePolyfills({
globals: {
Buffer: mode === "production",
},
}),
svgr(),
sentryVitePlugin({
org: "ssv-labs",
project: "javascript-react",
authToken: env.VITE_SENTRY_AUTH_TOKEN,
}),
],
define: {
APP_VERSION: JSON.stringify(process.env.npm_package_version),
NETWORKS: JSON.parse(env.VITE_SSV_NETWORKS),
"import.meta.env.VITE_SSV_NETWORKS": JSON.parse(env.VITE_SSV_NETWORKS),
...(mode === "development" ? { global: {} } : undefined),
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
optimizeDeps: {
esbuildOptions: {
define: {
"process.env.NODE_OPTIONS": '"--max-old-space-size=4096"',
},
},
},
};
});