-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
49 lines (46 loc) · 1.17 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
import { defineConfig, mergeConfig, UserConfig, UserConfigFn } from "vite";
const config = defineConfig((env) => {
const baseConfig = defineConfig({
root: "./src/",
base: "./",
build: {
// sourcemap: "inline",
// minify: false,
// lib: {
// entry: "index.ts",
// name: "ProcessHackarTreemapMemory",
// // fileName: (format) => `ProcessHackarTreemapMemory.${format}.js`,
// },
outDir: "../dist"
},
esbuild: {
supported: {
'top-level-await': true
},
},
});
let customConfig: UserConfig;
if (env.command === "serve") {
customConfig = {
// serve 独有配置
// server: {
// fs:{
// allow: true,
// },
// proxy: {
// "^/_m/.*": {
// target: "http://localhost:3000",
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/_m/, ""),
// },
// },
// },
};
} else {
customConfig = {
// build 独有配置
};
}
return mergeConfig(baseConfig, customConfig);
}) as UserConfigFn;
export default config;