CLI tool
unplugin/unplugin-vue-components avatar
unplugin/unplugin-vue-components

unplugin-vue-components ships ten module entries and one example project

📲 On-demand components auto importing for Vue

4,290 stars378 forksTypeScriptMIT

At a glance

What is it?
The Vue auto-import plugin is an ESM-only compiled package with a hardcoded src/components default, a CommonJS-shaped Webpack path, and built-in resolvers for popular UI libraries. This is the shape of the package behind the build-time transform.
Who is it for?
Adopt it if your Vue 3 project already follows the src/components convention and your bundler sits on the supported list, because those are the assumptions baked into the defaults. Check three things before you commit: whether your build can load an ESM-only plugin from a CommonJS config, whether components.d.ts gets picked up by your tsconfig include, and whether the library you use is one of the sixteen named resolvers.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Activity is slowing. The repository last received commits 6 months ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • unplugin/unplugin-vue-components4,290 ★ · -4
Star history
Repository2026-09-232026-11-22
unplugin/unplugin-vue-components4.3k4.3k

-4 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Ten module entry points and a single example project

The `exports` field is the honest inventory of this package. It declares eleven keys: the root, `./esbuild`, `./nuxt`, `./resolvers`, `./rolldown`, `./rollup`, `./rspack`, `./types`, `./vite`, `./webpack`, and `./package.json`. Every module entry resolves to a file under `dist`, and every one of those files carries the `.mjs` extension. `package.json` also sets `"type": "module"`, so there is no CommonJS build waiting behind them.

The repository tells a narrower story. Its tree contains exactly one example directory, `examples/vite-vue3/`, and the two example scripts both address that same directory with `npm -C examples/vite-vue3`. Vite is therefore the only bundler exercised in-tree.

Installation is one line, added as a dev dependency:

bash
npm i unplugin-vue-components -D

Peer requirements are narrow: `vue: ^3.0.0`, plus `@nuxt/kit` at `^3.2.2 || ^4.0.0` marked optional in `peerDependenciesMeta`.

Webpack and Rspack configs have to stay CommonJS shaped

Two of the documented setups sit awkwardly against the package's own module format. The Webpack and Rspack snippets are the only ones written with `module.exports` and `require`, and each carries the same pair of comment lines, one naming the config file and one reading `unplugin-vue-components removed support for CommonJS after version 29.1.0`.

That comment is the reason for the shape, not an oversight. Since 29.1.0 the plugin loads as ESM only, and the two bundlers whose canonical config format is still CommonJS have to reach it through `require`. The line is `require('unplugin-vue-components/webpack')({ /* options */ })`, an immediately invoked factory instead of the `Components({ /* options */ })` import used in every other snippet. That is also the version boundary worth remembering. the current version line, 32.1.0, is three majors past the break.

ts
// webpack.config.js
// unplugin-vue-components removed support for CommonJS after version 29.1.0
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-vue-components/webpack')({ /* options */ }),
  ],
}

The default scan directory is src/components, not yours

Out of the box the transform reads one directory: `src/components`. A note under the usage section states that the path can be changed with the `dirs` option. Neither the package name nor the published description gives any hint about the convention, so a project keeping widgets in `app/ui/` or `lib/fields/` resolves nothing until `dirs` names its own path.

The rewrite itself is mechanical. A template that references `HelloWorld` with no import at all compiles to the same template plus an `import HelloWorld from './src/components/HelloWorld.vue'` line and a `components: { HelloWorld }` entry in the options object. The generated specifier mirrors the convention, so a component sitting one level below the default directory produces a path the plugin writes for you. Parent registration carries along with it: when a parent component is registered asynchronously or sits behind a lazy route, the auto-imported component is code-split along with that parent instead of being pulled into an eager chunk.

html
<template>
  <div>
    <HelloWorld msg="Hello Vue 3.0 + Vite" />
  </div>
</template>

<script>
  import HelloWorld from './src/components/HelloWorld.vue'

  export default {
    name: 'App',
    components: {
      HelloWorld,
    },
  }
</script>

components.d.ts appears only when TypeScript is already there

TypeScript support is conditional on something outside the plugin's control. The config snippet that turns it on sets `dts: true`, with an inline comment saying it is enabled by default if `typescript` is installed.

The typing story is also unfinished upstream. Global component types need Vue itself to extend the interface for globally registered components, and that work is described as a pull request against the Vue core repository, number 3399, not as something this package controls. Volar is named as the editor that already understands the shape.

Either way the output is a real file on disk, `components.d.ts`, rewritten on every run, and committing it is left open as a choice. The README also says to add `components.d.ts` to `tsconfig.json` under `include`.

ts
Components({
  dts: true, // enabled by default if `typescript` is installed
})

A Nuxt entry point the same page steers you away from

`./nuxt` sits in the exports map, and `@nuxt/kit` is a peer dependency marked optional so that installing the plugin does not drag it in. The Nuxt block of the setup instructions then says you might not need this plugin for Nuxt, and points you at `@nuxt/components` instead.

Both statements hold at once, and that tension is the part worth reading closely. The published package maintains a Nuxt entry point and a peer range for it covering both the `^3.2.2` and `^4.0.0` lines, while its own documentation assigns that job to a different repository. The peer range is the hard number: a project resolving `@nuxt/kit` outside it sits outside what the package declares. Since Nuxt users are told to leave this plugin alone, the mismatch is something you would only meet by ignoring the instruction.

So treat `./nuxt` as an entry point that exists rather than an integration that is supported.

Sixteen resolvers, three of them maintained in other packages

At least sixteen libraries get a resolver, and most of them are a single TypeScript file under `src/core/resolvers`, named after the library: `antdv`, `arco`, `bootstrap-vue`, `element-plus`, `headless-ui`, `idux`, `inkline`, `ionic`, `naive-ui`, `prime-vue`, `quasar`, `tdesign`, `vant`, `varlet-ui` and `veui`. All of them have a resolver file in this repository.

TDesign, Vant and Varlet UI additionally point at their own package's resolver, `@tdesign-vue-next/auto-import-resolver`, `@vant/auto-import-resolver` and `@varlet/import-resolver`, described as that library's own auto-import resolver. The feature list also credits a tree-shakable registration path that only registers the components a template actually uses, folder names acting as namespaces, coverage of both components and directives, and a stated pairing with `unplugin-icons`.

The list continues with View UI.

Only dist is published, so the source never reaches node_modules

The `files` array holds one entry, `dist`. That single line decides what a consumer can inspect: the npm tarball contains compiled output and nothing else. No `src`, no resolver files, no example, no tests. The `typesVersions` map sends `*` to `./dist/*.d.mts` and `./*`, and the root `types` field points at `./dist/index.d.ts`, so the published type surface is generated next to the code rather than read from the sources that produced it.

Two consequences follow. A resolver's real behaviour has to be read from a built file or from the repository, never from an installed copy. And the visible runtime dependencies, `chokidar`, `local-pkg` and `magic-string`, name what sits underneath the transform without saying how any of it fails.

What the repository does carry is the tool wiring: `tsdown` for the build, `vitest` for tests, `eslint` for lint, `tsgo` for typecheck, `bumpp` for releases, `[email protected]` as the declared package manager, and an `engines` floor of Node `>=20.19.0`.

The rename from vite-plugin-components is still the first warning

Under the installation heading, before any configuration, the file leads with a rename notice: `vite-plugin-components` has been renamed to `unplugin-vue-components`, with the migration guide living as an anchor inside this same document. The package sits three majors past the point where CommonJS support was dropped.

The published description is thinner than the repository's own tagline. The repository calls the project on-demand components auto importing for Vue, while `package.json` shortens that to components auto importing for Vue, dropping the phrase that describes what the transform does at build time.

Then the release shape. The version `32.1.0` in `package.json` matches the newest tag, published the same minute as the most recent push to `main` on 2026-05-20. The repository is not archived. Two of the three recent releases, `v32.0.0` and `v31.1.0`, went out within a minute of each other on 2026-03-23, which reads like a major bump and its follow-up rather than three independent releases.

Editorial conclusion

Adopt it if your Vue 3 project already follows the src/components convention and your bundler sits on the supported list, because those are the assumptions baked into the defaults. Check three things before you commit: whether your build can load an ESM-only plugin from a CommonJS config, whether components.d.ts gets picked up by your tsconfig include, and whether the library you use is one of the sixteen named resolvers. If you are on Nuxt, its own guidance points you at @nuxt/components instead.

Frequently asked questions

What is unplugin-vue-components?

A build-time transform for Vue 3 templates, published at version 32.1.0. It rewrites template usage into an explicit import plus a component registration, scans `src/components` by default, and ships separate entry points for Vite, Rollup, Rolldown, Webpack, Rspack, esbuild and Nuxt.

What are components in Vue?

The plugin leaves what a component is alone and removes the two lines one normally needs. The usage example shows a template carrying no import at all becoming the same template plus an `import HelloWorld from './src/components/HelloWorld.vue'` line and a `components: { HelloWorld }` entry.

How do you create a Vue component?

Creating components is outside this repository. The only convention it imposes is the directory it scans, `src/components`, adjustable through the `dirs` option. The repository ships one worked example, `examples/vite-vue3/`, and it is the only one.

What is the best component library for Vue?

Nothing in the project ranks libraries. Resolvers exist for many named libraries, and for TDesign, Vant and Varlet UI the README also points to that library's own auto-import resolver package.

Is Vue.js still widely used?

The package says nothing about adoption. It does fix the version boundary: peer dependencies ask for `vue: ^3.0.0`, the feature list opens with support for Vue 3 out of the box, and `engines` requires Node `>=20.19.0`.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. unplugin/unplugin-vue-components on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/unplugin-unplugin-vue-components.svg)](https://hysenlabs.com/projects/unplugin-unplugin-vue-components)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/unplugin-unplugin-vue-components.svg)](https://hysenlabs.com/projects/unplugin-unplugin-vue-components)

Was this useful?