/
vite.config.js
58 lines (55 loc) · 1.44 KB
/
vite.config.js
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
// import { defineConfig } from 'vite'
// import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
// export default defineConfig({
// plugins: [vue()],
// })
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from "path"
import PurgeIcons from 'vite-plugin-purge-icons'
export default defineConfig({
plugins: [
vue(),
PurgeIcons({
/* PurgeIcons Options */
})
],
base: "./",
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"assets": path.resolve(__dirname, "src/assets/"),
"img": path.resolve(__dirname, "src/assets/img"),
"styles": path.resolve(__dirname, "src/styles/"),
"pages": path.resolve(__dirname, "src/pages/"),
},
},
server: {
port: 3000
},
build: {
rollupOptions: {
output: {
chunkFileNames: "js/[name].[hash].js",
entryFileNames: "js/[name].[hash].js",
assetFileNames: (info) => {
let type = info.name.split(".")[1];
if (/png|jpe?g|svg|gif|tiff|bmp|ico|webp/i.test(type)) {
type = "img";
} else if (/ttf|eot|woff|woff2/i.test(type)) {
type = "fonts"
} else if (/mp4|webm|ogg/i.test(type)) {
type = "video"
} else if (/mp3|wav/i.test(type)) {
type = "sound"
}
return `${type}/[name]-[hash].[ext]`;
},
}
}
},
css: {
devSourcemap: true
}
});