-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
76 lines (75 loc) · 1.86 KB
/
Copy pathvite.config.ts
File metadata and controls
76 lines (75 loc) · 1.86 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
71
72
73
74
75
76
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import svgr from "vite-plugin-svgr";
import { sentryVitePlugin } from "@sentry/vite-plugin";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import { version } from "./package.json";
import path from "path";
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
svgr(),
nodePolyfills({
include: ["util", "buffer", "process"],
globals: {
Buffer: true,
global: true,
process: true,
},
}),
// Only include Sentry plugin if auth token is available
process.env.SENTRY_AUTH_TOKEN &&
sentryVitePlugin({
org: "tattoo-directory",
project: "javascript-react",
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: `tattoo-directory@${version}`,
},
sourcemaps: {
assets: ["./dist/**"],
},
}),
].filter(Boolean),
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
extensions: [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"],
},
build: {
sourcemap: true,
outDir: "dist",
assetsDir: "assets",
emptyOutDir: true,
rollupOptions: {
input: {
main: path.resolve(__dirname, "index.html"),
},
},
},
esbuild: {
pure: ["console.log", "console.warn"],
},
define: {
__SENTRY_RELEASE__: JSON.stringify(`tattoo-directory@${version}`),
global: "globalThis",
"process.env": {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
},
optimizeDeps: {
include: ["@sentry/react"],
},
server: {
force: true, // Re-optimize deps on start; avoids 504 Outdated Optimize Dep
proxy: {
"/api": {
target: "http://localhost:3001",
changeOrigin: true,
secure: false,
},
},
},
});