-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
30 lines (29 loc) · 1.01 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
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx()],
build: {
rollupOptions: {
output: {
assetFileNames: (assetInfo) => {
var info = assetInfo.name.split(".");
var extType = info[info.length - 1];
if (
/\.(mp4|webm|ogg|mp3|wav|wma|flac|aac|3gp|avi|flv|mkv|mov|rmvb|ts|vob|webm|wmv)(\?.*)?$/i.test(assetInfo.name)
) {
extType = "media";
} else if (/\.(png|jpe?g|gif|svg|bmp|tiff|webp)(\?.*)?$/i.test(assetInfo.name)) {
extType = "img";
} else if (/\.(woff2?|eot|ttf|otf|ttc|fnt)(\?.*)?$/i.test(assetInfo.name)) {
extType = "fonts";
}
return `static/${extType}/[name]-[hash][extname]`;
},
chunkFileNames: "static/js/[name]-[hash].js",
entryFileNames: "static/js/[name]-[hash].js",
},
},
},
});