unplugin-vue-components
unplugin-vue-components copied to clipboard
如何配置指定名称的组件才在components.d.ts文件中生成类型声明
例如,有如下组件目录结构:
--component-a
----child-a.vue
----child-b.vue
----index.vue
这样index.vue
、child-a.vue
、child-b.vue
都会生成类型声明,但实际上child-a
和child-b
组件作为component-a
组件的子组件,并不需要单独对外暴露的,而且child-a.vue
、child-b.vue
还有可能与其它组件重名,有没有办法只匹配到名字为index
的组件才生成类型声明,尝试了include
属性,好像没效果
@JackieCheung
currently you can't do this Glob Scan does not filter files by include/exclude (they are settings for transform)
I also want this feature because I don't want type declarations provided by Vue2 UI library (all the component types are any
), I define the types of these components myself. While I still want unplugin-vue-components
to generate other components' type for me.
I also want this feature too.
您好,请问有解决办法了吗?我也有这个困惑
@lishaobos 大佬你这个pr怎么使用啊
就是和 glob 规则一样,你最开始加个 ! , 例如:!src/xx.vue
@lishaobos
你有遇到这种情况嘛,我的插件是最新的,也重启重装过依赖
这个 globs 里面可以写多个,你写了一个排除,可以再写几个命中,类似于下面
globs: [
'src/components/*.vue',
'!src/components/ComponentA.vue',
],
globs: [
'!src/components/**/modules/*.vue', //排除components下的所有modules文件夹里的组件
'src/components/*.vue',
'src/components/**/index.vue',
],
使用这种方式来排除