unplugin-unused
v0.2.3
Published
Check unused dependencies.
Downloads
3,757
Maintainers
Readme
unplugin-unused
Check unused dependencies.
Installation
npm i -D unplugin-unused
Usage
Unused({
include: [/\.([cm]?[jt]sx?|vue)$/],
exclude: [/node_modules/],
level: 'warning', // or 'error'
/**
* Ignore some dependencies.
*/
ignore: {
peerDependencies: ['vue'],
},
// Or ignore all kinds of dependencies.
// ignore: ['vue'],
/**
* Dependency kinds to check.
*/
depKinds: ['dependencies', 'peerDependencies'],
})
// vite.config.ts
import UnpluginUnused from 'unplugin-unused/vite'
export default defineConfig({
plugins: [UnpluginUnused()],
})
// rollup.config.js
import UnpluginUnused from 'unplugin-unused/rollup'
export default {
plugins: [UnpluginUnused()],
}
// rolldown.config.js
import UnpluginUnused from 'unplugin-unused/rolldown'
export default {
plugins: [UnpluginUnused()],
}
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [require('unplugin-unused/esbuild')()],
})
// webpack.config.js
module.exports = {
/* ... */
plugins: [require('unplugin-unused/webpack')()],
}