-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
35 lines (32 loc) · 1001 Bytes
/
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
import { defineConfig } from 'vite';
import basicSsl from '@vitejs/plugin-basic-ssl';
export default defineConfig({
base: './',
assetsInclude: ['**/*.gltf'],
plugins: process.env.SSL === 'true' ? [basicSsl()] : undefined,
esbuild: {
// This is to be able to use ComponentClass.name in `registerComponent`.
// See src/web/components/component/util/register-component.ts.
keepNames: true,
},
build: {
rollupOptions: {
output: {
assetFileNames: (asset) => {
const extension = asset.name?.split('.').pop() ?? '';
let directory: string;
if (/png|jpe?g|svg|gif/i.test(extension)) {
directory = 'images';
} else if (/gltf/i.test(extension)) {
directory = 'geometries';
} else if (/css/i.test(extension)) {
directory = 'css';
} else {
directory = '.';
}
return `assets/${directory}/[name][extname]`;
},
},
},
},
});