forked from RSSNext/Follow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
55 lines (50 loc) · 1.44 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
import { readFileSync } from "node:fs"
import { resolve } from "node:path"
import { fileURLToPath } from "node:url"
import { sentryVitePlugin } from "@sentry/vite-plugin"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
import { getGitHash } from "./scripts/lib"
const pkg = JSON.parse(readFileSync("package.json", "utf8"))
const __dirname = fileURLToPath(new URL(".", import.meta.url))
export default defineConfig({
build: {
outDir: resolve(__dirname, "out/web"),
target: "ES2022",
sourcemap: true,
},
root: "./src/renderer",
envDir: resolve(__dirname, "."),
resolve: {
alias: {
"@renderer": resolve("src/renderer/src"),
"@shared": resolve("src/shared/src"),
"@pkg": resolve("./package.json"),
"@env": resolve("./src/env.ts"),
},
},
base: "/",
plugins: [
react(),
sentryVitePlugin({
org: "follow-rg",
project: "follow",
disable: process.env.NODE_ENV === "development",
moduleMetadata: {
appVersion:
process.env.NODE_ENV === "development" ? "dev" : pkg.version,
electron: false,
},
}),
],
define: {
APP_VERSION: JSON.stringify(pkg.version),
APP_NAME: JSON.stringify(pkg.name),
APP_DEV_CWD: JSON.stringify(process.cwd()),
GIT_COMMIT_SHA: JSON.stringify(
process.env.VERCEL_GIT_COMMIT_SHA || getGitHash(),
),
DEBUG: process.env.DEBUG === "true",
ELECTRON: "false",
},
})