-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathvite.config.ts
More file actions
85 lines (81 loc) · 1.83 KB
/
Copy pathvite.config.ts
File metadata and controls
85 lines (81 loc) · 1.83 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/// <reference types="histoire" />
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { defineConfig } from 'vite'
import dayjsPlugin from 'vite-plugin-dayjs'
import VueJsxAutoProps from 'vite-plugin-tsx-resolve-types'
const base = fileURLToPath(new URL('.', import.meta.url))
const comps = [
['util', 'util/dist'],
'util',
'checkbox',
'resize-observer',
'input',
'portal',
'collapse',
'pagination',
'nutate-observer',
'notification',
'progress',
'rate',
'steps',
'virtual-list',
'switch',
'qrcode',
'trigger',
'dialog',
'drawer',
'tooltip',
'slider',
'mini-decimal',
'input-number',
'dropdown',
'textarea',
'async-validator',
'segmented',
'fast-color',
'color-picker',
'overflow',
'menu',
'select',
'tree',
'tree-select',
]
export function genListAlias() {
const alias = []
for (const comp of comps) {
if (Array.isArray(comp)) {
const [dir, name] = comp
alias.push({
find: new RegExp(`^@v-c\/${name}`),
replacement: resolve(base, 'packages', dir, 'src'),
})
}
else {
alias.push({
find: new RegExp(`^@v-c\/${comp}`),
replacement: resolve(base, 'packages', comp, 'src'),
})
}
}
return alias
}
export default defineConfig({
plugins: [
dayjsPlugin(),
vue(),
vueJsx(),
VueJsxAutoProps({
defaultPropsToUndefined: true,
}),
],
resolve: {
alias: [
// Force all packages to use the same Vue instance to avoid reactivity mismatch in tests/dev.
{ find: /^vue$/, replacement: resolve(base, 'node_modules/vue/dist/vue.esm-bundler.js') },
...genListAlias(),
],
},
})