Skip to content

配置了 types 属性后,原本会自动生成类型的全局组件例如 RouterView 就不会在components.d.ts文件中自动生成类型了 #855

@Syeeling

Description

@Syeeling

在官方文档说明中,默认情况下 (在没有配置 types 属性时),unplugin-vue-components 会在支持的库(例如vue-router)安装到工作区时自动检测并在 components.d.ts 文件中添加其类型。

现在我自定义注册了一些全局组件,希望将它们在 components.d.ts 文件中标注类型,例如:

import Components from 'unplugin-vue-components/vite'
import * as ElementPlusIcons from '@element-plus/icons-vue'

export default function AutoRegistryComponents() {
return Components({
// ......
types: [{
from: '@element-plus/icons-vue',
names: Object.keys(ElementPlusIcons)
}],
dts: 'types/components.d.ts' // 指定生成的 .d.ts 文件
})
}

但是当我配置了 types 属性后,原本会自动注册类型的全局组件例如 RouterView 现在就不会自动在 components.d.ts 文件中注册类型了。
我希望在不影响默认行为的情况下,给 types 添加一些配置,而非覆盖,请问需要如何处理?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy