forked from cloudhao1999/cloud-app-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
42 lines (39 loc) · 1.03 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
import { defineConfig, loadEnv } from "vite";
import alias from "./vite/alias";
import { parseEnv } from "./vite/util";
import setupPlugins from "./vite/plugins";
import { visualizer } from "rollup-plugin-visualizer";
export default defineConfig(({ command, mode }) => {
const isBuild = command === "build";
const env = parseEnv(loadEnv(mode, process.cwd()));
return {
plugins: [...setupPlugins(isBuild, env), visualizer()],
resolve: {
alias,
extensions: [".ts", ".js", ".vue", ".json"]
},
build: {
outDir: "./dist/",
rollupOptions: {
emptyOutDir: true,
output: {
manualChunks(id: string) {
if (id.includes("node_modules")) {
return id.split("/node_modules/").pop()?.split("/")[0];
}
}
}
}
},
server: {
host: true,
port: env.VITE_PORT,
proxy: {
"/api": {
target: env.VITE_MOCK_ENABLE ? "/" : env.VITE_API_URL,
changeOrigin: true
}
}
}
};
});