-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
42 lines (39 loc) · 1.23 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 } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
base: "/",
assetsInclude: ["**/*.glb", "**/*.hdr", "**/*.gltf", "**/*.bin"],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@components": path.resolve(__dirname, "./src/components"),
"@widgets": path.resolve(__dirname, "./src/widgets"),
"@shared": path.resolve(__dirname, "./src/shared"),
"@assets": path.resolve(__dirname, "./src/assets"),
},
},
publicDir: "public",
build: {
assetsDir: "assets",
rollupOptions: {
input: {
main: path.resolve(__dirname, "index.html"),
},
output: {
chunkFileNames: "assets/js/[name]-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: (assetInfo) => {
const fileName = assetInfo.name ?? "unknown";
const extType = fileName.split(".").pop()?.toLowerCase() ?? "";
if (/glb|hdr|gltf|bin/i.test(extType)) {
return `assets/models/[name]-[hash][extname]`;
}
return `assets/[name]-[hash][extname]`;
},
},
},
},
});