-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvite.config.ts
60 lines (58 loc) · 1.34 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import VueRouter from 'unplugin-vue-router/vite'
import UnoCSS from 'unocss/vite'
import { resolve } from 'node:path'
const PROD = process.env.NODE_ENV === 'production'
export default defineConfig({
base: './',
plugins: [
Vue(),
AutoImport({
dts: 'docs/auto-imports.d.ts',
vueTemplate: true,
imports: ['vue', 'vue-router', '@vueuse/core', 'pinia'],
dirs: [
'docs/components/**',
'docs/stores',
'docs/utils',
'docs/types',
'docs/models/**',
],
}),
Components({
dts: 'docs/components.d.ts',
dirs: ['docs/components'],
resolvers: [],
}),
VueRouter({
dts: 'docs/router.d.ts',
routesFolder: 'docs/pages',
getRouteName(node) {
const name = node.fullPath
.replaceAll('/', '-')
.replace(/^-/, '')
.replace(/^\d+\-?/, '')
return name || 'index'
},
}),
UnoCSS(),
],
build: {
outDir: '.docs_dist',
},
resolve: {
alias: {
'@': resolve(import.meta.dirname, 'docs'),
},
},
esbuild: {
drop: PROD ? ['console'] : [],
},
server: {
host: '0.0.0.0',
port: 1005,
},
})