Vue Unused Components Checker

raw JSON →
1.1.2 verified Sat Apr 25 auth: no javascript maintenance

A CLI tool to detect unused `.vue` components in Vue.js projects. Version 1.1.2 (latest as of May 2021) scans the file tree for `.vue` files and checks if they are imported and used anywhere. It supports limiting open files for large directories and ignoring glob patterns (e.g., node_modules). The tool is simple, focused, and works with Vue 2 projects. It is not actively maintained (no releases since 2021). Alternatives like `eslint-plugin-vue` with `no-unused-components` provide deeper analysis.

error Error: Cannot find module 'vue-unused-components-checker'
cause CLI command called incorrectly; package might be installed globally but command name is different.
fix
Use check-unused-comp . instead of vue-unused-components-checker .
error Error [ERR_REQUIRE_ESM]: require() of ES Module
cause Using CommonJS require on an ESM-only package.
fix
Use import { checkUnusedComponents } from 'vue-unused-components-checker' or convert project to ESM.
error ENAMETOOLONG: name too long
cause File paths too long when scanning large directories with many nested folders.
fix
Use -o 20 to limit open files and avoid hitting the OS path length limit.
gotcha CLI command is 'check-unused-comp', not 'vue-unused-components-checker'
fix Run `check-unused-comp .` instead of trying to run the package name directly.
breaking CommonJS require does not work; package is ESM-only
fix Use `import` syntax or set `"type": "module"` in your package.json.
deprecated No updates since 2021; consider migrating to eslint-plugin-vue with no-unused-components rule
fix Switch to eslint-plugin-vue for better maintenance and integration.
gotcha Max open files option is -o but takes a number without flag name, e.g., -o 20
fix Use `-o 20` (no equals sign) to limit open files.
npm install vue-unused-components-checker
yarn add vue-unused-components-checker
pnpm add vue-unused-components-checker

Programmatic usage that scans src/ directory for unused .vue components and logs the list.

import { checkUnusedComponents } from 'vue-unused-components-checker';
const path = require('path');
const results = checkUnusedComponents({
  rootDir: path.resolve('./src'),
  ignorePatterns: ['**/node_modules/**'],
  maxOpenFiles: 50
});
console.log(results.unused);