unplugin-vue-components registers Vue components and directives as you use them in templates. It integrates with Vite, Webpack, Rollup, and other bundlers via unplugin.
Overview
unplugin-vue-components is a build plugin that removes manual import and registration for Vue single-file components and directives. In templates you reference components by name; the plugin resolves files under configured directories (default src/components) and injects imports only for symbols actually used, enabling tree shaking.
Vue 3 is supported out of the box, with folder names acting as namespaces. TypeScript users can generate a components.d.ts manifest for global component types, which Volar can consume when configured in tsconfig. Built-in resolvers connect popular UI libraries so library components can resolve without explicit imports; custom resolvers are also supported.
The plugin runs across the unplugin ecosystem: Vite, Rollup, Rolldown, Webpack, Rspack, esbuild, Quasar, and Nuxt-related setups (though Nuxt may use @nuxt/components instead). Globally registered components from routers or other libraries can be listed for type registration only without auto-importing their runtime code.
Async parent components or lazy routes keep auto-imported children in the same code-split chunks as their parents.
Key features
- Template-driven component imports
- Vue 3 components and directives
- Tree-shakable on-demand registration
- Folder namespace resolution
- TypeScript components.d.ts generation
- UI library resolver presets
- Custom resolver hooks
- Multi-bundler unplugin support
Use cases
- Vite Vue 3 application builds
- Reducing boilerplate component imports
- UI library on-demand loading
- Type-safe global component names