Skip to content

Supports scanning files and automatically imports all components #823

Open
@guaijie

Description

@guaijie

Clear and concise description of the problem

// components/index.ts

export { default as Table } from './Table'
export { default as Form} from './Form'

export default Button

vite.config.ts

export default defineConfig({
  plugins: [
    vue(),
    components({
      dirs: ['src/components/index.ts']
    })
  ]
})
``

components.d.ts
```ts
declare module 'vue' {
  export interface GlobalComponents {
    Table: typeof import('./src/components/index.ts')['Table'],
    Form: typeof import('./src/components/index.ts')['Form']
    Button: typeof import('./src/components/index.ts')['default']
  }
}

Suggested solution

no response

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions