-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvite.frontend.config.mts
More file actions
58 lines (56 loc) · 1.67 KB
/
vite.frontend.config.mts
File metadata and controls
58 lines (56 loc) · 1.67 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import react from '@vitejs/plugin-react-swc';
import { resolve } from 'path';
import { defineConfig, type PluginOption } from 'vite';
import { vitePluginNativeImportMaps } from 'vite-plugin-native-import-maps';
import sass from 'vite-plugin-sass';
// TODO: this might be useful for letting plugins import omegga components
// import dts from 'vite-plugin-dts';
// https://vite.dev/config/
export default defineConfig({
root: resolve(__dirname, 'frontend'),
plugins: [
sass(),
react(),
// dts(),
// Provide an import-map for plugins to provide custom ui
vitePluginNativeImportMaps({
shared: [
'react',
'react-dom',
'react/jsx-runtime',
'@tabler/icons-react',
'nanostores',
'@nanostores/react',
'wouter',
{ name: '@components', entry: 'frontend/src/components/index.ts' },
{ name: '@utils', entry: 'frontend/src/utils.ts' },
{ name: '@hooks', entry: 'frontend/src/hooks/index.ts' },
],
sharedOutDir: 'shared',
log: true,
}) as PluginOption,
],
publicDir: 'public',
resolve: {
alias: {
'@components': resolve(__dirname, 'frontend/src/components'),
'@utils': resolve(__dirname, 'frontend/src/utils'),
'@hooks': resolve(__dirname, 'frontend/src/hooks'),
},
},
assetsInclude: ['**/*.webp'],
build: {
sourcemap: true,
rollupOptions: {
input: {
auth: resolve(__dirname, 'frontend/auth.html'),
app: resolve(__dirname, 'frontend/app.html'),
},
external: ['@omegga'],
},
emptyOutDir: true,
outDir: resolve(__dirname, 'public'),
copyPublicDir: false,
chunkSizeWarningLimit: 8000,
},
});