-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
86 lines (76 loc) · 2.25 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
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
86
/// <reference types="vitest" />
import path from 'node:path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Pages from 'vite-plugin-pages'
import VueJsx from '@vitejs/plugin-vue-jsx'
import Layouts from 'vite-plugin-vue-layouts'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Unocss from 'unocss/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
// @ts-expect-error failed to resolve types
import ReactivityTransform from '@vue-macros/reactivity-transform/vite'
export default defineConfig({
resolve: {
alias: {
'@/': `${path.resolve(__dirname, 'src')}/`,
},
},
plugins: [
Vue(),
/**
* reactivityTransform 已于 Vue 3.3 版本被标记为已弃用,Vue 3.4 版本于核心包中移除
* 详情参见 @see https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028
* 现已在 Vue Macros 外部实现
* {@link 文档 https://vue-macros.sxzz.moe/features/reactivity-transform.html}
*/
ReactivityTransform(),
/** @see https://github.com/hannoeru/vite-plugin-pages */
Pages({
extensions: ['vue', 'ts', 'js', 'tsx', 'jsx'],
exclude: ['**/components/*.vue'],
dirs: [
{ dir: 'src/pages', baseRoute: '' },
],
}),
/** @see https://github.com/johncampionjr/vite-plugin-vue-layouts */
Layouts(),
/** @see https://github.com/antfu/unplugin-auto-import */
AutoImport({
imports: [
'vue',
'vue/macros',
'vue-router',
'@vueuse/core',
{
'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar'],
},
],
dts: true,
dirs: [
'./src/composables',
],
vueTemplate: true,
}),
/** @see https://github.com/antfu/vite-plugin-components */
Components({
dts: true,
resolvers: [NaiveUiResolver()],
}),
/**
* @see https://github.com/antfu/unocss
* see unocss.config.ts for config
*/
Unocss(),
/**
* JSX 配置
* @see https://github.com/vitejs/vite-plugin-vue
*/
VueJsx(),
],
/** @see https://github.com/vitest-dev/vitest */
test: {
environment: 'jsdom',
},
})