-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.macros.ts
36 lines (34 loc) · 1.19 KB
/
vite.config.macros.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
import type { PluginOption } from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import DefinePropsRefs from '@vue-macros/define-props-refs/vite'
import DefineProps from '@vue-macros/define-props/vite'
import ReactivityTransform from '@vue-macros/reactivity-transform/vite'
export default (): PluginOption[] => ([
vuePlugin({
template: {
compilerOptions: {
isCustomElement: (tag: string) => ['def'].includes(tag),
},
},
}),
vueJsx(),
/**
* Reactivity Transform
* @description 响应性语法糖
* @see https://vue-macros.sxzz.moe/zh-CN/features/reactivity-transform.html
*/
ReactivityTransform(),
/**
* defineProps
* @description 使用 $defineProps 可以正确地解构 props 的类型
* @see https://vue-macros.sxzz.moe/zh-CN/macros/define-props.html
*/
DefineProps(),
/**
* definePropsRefs
* @description 从 defineProps 中将返回 refs 而不是 reactive 对象,可以在不丢失响应式的情况下解构 props
* @see https://vue-macros.sxzz.moe/zh-CN/macros/define-props-refs.html
*/
DefinePropsRefs(),
])