-
Notifications
You must be signed in to change notification settings - Fork 64
/
vite.config.mts
54 lines (53 loc) · 1.45 KB
/
vite.config.mts
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
import path from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import { svgBuilder } from "./src/icons/loader";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx(), svgBuilder("./src/icons/svg/")],
base: "./",
resolve: {
alias: {
"@": path.resolve(__dirname, "src")
}
},
server: {
port: 1088,
host: "0.0.0.0",
// proxy: {
// "/free": {
// target: "https://www.tianqiapi.com",
// changeOrigin: true,
// rewrite: path => path.replace(/^\//, "")
// }
// }
},
build: {
rollupOptions: {
output: {
// manualChunks: {
// "package-name": ["file-name"],
// "element-plus": ["element-plus"],
// },
manualChunks(id) {
if (id.includes("node_modules")) {
return "vendor";
}
},
entryFileNames: "js/[name]-[hash].js",
chunkFileNames: "js/[name]-[hash].js",
assetFileNames(target) {
if (target.name?.endsWith(".css")) {
return "css/[name]-[hash].css";
}
const imageTypes = [".png", "jpg", "jpeg", ".webp", ".gif"];
if (target.name && imageTypes.some(type => target.name!.endsWith(type))) {
return "image/[name]-[hash].[ext]";
}
return "assets/[name]-[hash].[ext]";
}
}
}
},
})