-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.web-docker.ts
49 lines (45 loc) · 1.15 KB
/
vite.config.web-docker.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
import { defineConfig, loadEnv } from "vite";
import { fileURLToPath, URL } from "url";
import { resolve } from "path";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
const noHash = env.VITE_APP_REMOVE_HASH_FROM_ASSETS === "true";
const entries = noHash
? {
entryFileNames: "assets/[name].js",
chunkFileNames: "chunks/[name].js",
}
: {};
const base = (env.VITE_APP_BASE_PATH ?? "/").concat("web-docker/");
return {
base: base,
build: {
lib: {
entry: resolve(__dirname, "src/core/index.ts"),
name: "WebDocker",
fileName: "index",
},
sourcemap: env.VITE_APP_SOURCE_MAPS_ENABLED === "true",
outDir: "dist",
rollupOptions: {
output: {
...entries,
format: env.VITE_APP_MODULE_FORMAT as
| "es"
| "cjs"
| "amd"
| "iife"
| "umd"
| "system"
| undefined,
},
},
},
resolve: {
alias: {
"~": fileURLToPath(new URL("./src", import.meta.url)),
},
},
};
});