-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
49 lines (46 loc) · 1.07 KB
/
vite.config.ts
File metadata and controls
49 lines (46 loc) · 1.07 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
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite";
const rootDir = fileURLToPath(new URL(".", import.meta.url));
const repoRoot = path.resolve(rootDir, "..");
export default defineConfig(({ mode }) => {
const buildTarget = mode === "lib" ? "lib" : "site";
const base =
process.env.PSYFLOW_BASE ??
(mode === "pages" ? "/psyflow-web/" : "/");
return {
base,
resolve: {
alias: {
"psyflow-web": path.resolve(rootDir, "src/index.ts")
}
},
build:
buildTarget === "lib"
? {
lib: {
entry: "src/index.ts",
name: "PsyflowWeb",
fileName: "index",
formats: ["es"]
},
sourcemap: true,
target: "es2022"
}
: {
sourcemap: true,
target: "es2022"
},
server: {
host: "127.0.0.1",
port: 4173,
fs: {
allow: [repoRoot]
}
},
preview: {
host: "127.0.0.1",
port: 4173
}
};
});