-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
65 lines (62 loc) · 1.78 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
import react from "@vitejs/plugin-react-swc";
import { resolve } from "path";
import { CommonServerOptions, UserConfig, defineConfig } from "vite";
const userConfig: UserConfig = {
plugins: [react()],
base: "./",
root: "gui/apps",
build: {
emptyOutDir: true,
outDir: resolve("build/Release/gui"),
rollupOptions: {
output: {
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`,
},
input: {
home: resolve("gui/apps/home/index.html"),
settings: resolve("gui/apps/settings/index.html"),
url: resolve("gui/apps/url/index.html"),
},
},
},
resolve: {
alias: {
root: resolve("./"),
data: resolve("data"),
apps: resolve("gui/apps"),
assets: resolve("gui/assets"),
components: resolve("gui/components"),
css: resolve("gui/css"),
libs: resolve("gui/libs"),
modules: resolve("modules"),
scripts: resolve("scripts"),
src: resolve("src"),
},
},
};
const commonServerOptions: CommonServerOptions = {
port: 8000,
https: {
pfx: resolve("../.cert/localhost.pfx"),
passphrase: "localhost",
},
};
// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
switch (command) {
case "serve": {
return {
...userConfig,
server: { ...commonServerOptions },
preview: { ...commonServerOptions },
};
}
default: {
return {
...userConfig,
};
}
}
});