-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
38 lines (36 loc) · 1.12 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
import { defineConfig } from "vite";
import { resolve } from "path";
const root = resolve(__dirname, "./src");
const outDir = resolve(__dirname, "public");
export default defineConfig({
base: '/dive-into/',
root,
build: {
outDir,
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(root, "index.html"),
about: resolve(root, "about-us/about-us.html"),
members: resolve(root, "members/members.html"),
projects: resolve(root, "projects/projects.html"),
},
output: {
assetFileNames: (assetInfo) => {
var info = assetInfo.name.split(".");
var extType = info[info.length - 1];
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
extType = "img";
} else if (/woff|woff2/.test(extType)) {
extType = "fonts";
} else if (/css/.test(extType)) {
extType = "css";
}
return `assets/${extType}/[name]-[hash][extname]`;
},
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
},
},
},
});