-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
41 lines (37 loc) · 1.03 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
import { resolve } from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { Routes } from './src/routes';
import { layoutAssets } from './src/layouts/layout.list';
const entries = Object.entries(Routes).reduce((previousValue, [page, route]) => {
return [...previousValue, ...route.getClientEntries(page).map((entry) => `/${entry}`)];
}, []);
Object.values(layoutAssets).forEach((assets) =>
Object.values(assets || {}).forEach((asset) =>
(asset || []).forEach((entry) => {
if (entry && typeof entry !== 'string' && !entry.local) {
return;
}
return entry && entries.push(`/${entry}`);
}),
),
);
export default defineConfig({
root: 'src',
plugins: [react()],
build: {
emptyOutDir: true,
manifest: true,
outDir: '../dist/client',
assetsDir: 'ui',
rollupOptions: {
input: entries,
},
},
resolve: {
alias: {
'@fonts': resolve(__dirname, 'assets', 'fonts'),
'@style': resolve(__dirname, 'src', 'styles'),
},
},
});