{"id":20646,"library":"unused-files-webpack-plugin","title":"unused-files-webpack-plugin","description":"A Webpack plugin that globs all files under the webpack context and reports which files are not required by the bundle. Version 3.4.0 is the latest stable release, with an unclear release cadence (last release appears to be in 2018). It differs from alternatives like `unused-webpack-plugin` by using `glob-all` for pattern matching and supporting `failOnUnused` to emit errors. The plugin helps identify dead code and redundant files in webpack projects. Note: The plugin is no longer actively maintained; users should consider alternatives or verify compatibility with modern webpack versions.","status":"maintenance","version":"3.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/tomchentw/unused-files-webpack-plugin","tags":["javascript","unused","redundancy","files","require","webpack","webpack-plugin"],"install":[{"cmd":"npm install unused-files-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add unused-files-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add unused-files-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for globbing patterns to find unused files","package":"glob-all","optional":false},{"reason":"Peer dependency; plugin hooks into webpack compilation","package":"webpack","optional":true}],"imports":[{"note":"Package exports default as both ES module and CommonJS; require() returns default, not named.","wrong":"const UnusedFilesWebpackPlugin = require('unused-files-webpack-plugin')","symbol":"default","correct":"import UnusedFilesWebpackPlugin from 'unused-files-webpack-plugin'"},{"note":"Named export is also available in ES module; in CJS, it's { UnusedFilesWebpackPlugin } directly from require().","wrong":"const { UnusedFilesWebpackPlugin } = require('unused-files-webpack-plugin').default","symbol":"UnusedFilesWebpackPlugin","correct":"import { UnusedFilesWebpackPlugin } from 'unused-files-webpack-plugin'"},{"note":"TypeScript types are included; use type import for options interface.","wrong":"","symbol":"PluginOptions","correct":"import type { PluginOptions } from 'unused-files-webpack-plugin'"}],"quickstart":{"code":"// webpack.config.js\nconst UnusedFilesWebpackPlugin = require('unused-files-webpack-plugin');\n\nmodule.exports = {\n  // ... other webpack config\n  plugins: [\n    new UnusedFilesWebpackPlugin({\n      patterns: ['**/*.*'],\n      failOnUnused: false,\n      globOptions: {\n        ignore: 'node_modules/**/*'\n      }\n    })\n  ]\n};","lang":"javascript","description":"Shows how to add the plugin to webpack config with default options, identifying all files not compiled."},"warnings":[{"fix":"Consider alternatives like `unused-webpack-plugin` or `webpack-deadcode-plugin`.","message":"Plugin is no longer actively maintained; last update in 2018.","severity":"deprecated","affected_versions":">=3.0"},{"fix":"Specify more focused patterns, e.g., `['**/*.js', '**/*.jsx']`.","message":"Default pattern `**/*.*` may include binary or large files, causing performance issues.","severity":"gotcha","affected_versions":"all"},{"fix":"Use webpack 4 or patch plugin; consider migrating to a maintained plugin.","message":"Incompatible with webpack 5 due to changed compiler hooks.","severity":"broken","affected_versions":">=4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install glob-all` or ensure it is in package.json.","cause":"Missing dependency `glob-all`","error":"Cannot find module 'glob-all'"},{"fix":"Use `const UnusedFilesWebpackPlugin = require('unused-files-webpack-plugin')` for CJS or `import UnusedFilesWebpackPlugin from '...'` for ESM.","cause":"Wrong import style; default import used as named","error":"TypeError: UnusedFilesWebpackPlugin is not a constructor"},{"fix":"Run `npm install --save-dev unused-files-webpack-plugin`.","cause":"Package not installed","error":"Error: Cannot find module 'unused-files-webpack-plugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}