Webpack plugin to clean up extraneous files from the output path after compilation. Version 0.5.1 is the latest stable release; the package is no longer actively maintained. It removes files not generated by the current webpack build, useful for production builds to avoid stale assets. Alternatives like clean-webpack-plugin or output.clean (webpack 5+) are preferred. Supports exclude patterns (minimatch globs), quiet mode, and preview mode to list files without deletion.
npm install webpack-cleanup-pluginVerified import paths — ran on the pinned version, not inferred.
Shows minimal webpack config with webpack-cleanup-plugin that previews files to delete except excluded patterns.
Always use preview: true in development to verify files before deletion. Ensure exclude patterns cover non-webpack assets.
Consider using output.clean: true in webpack 5 or migrate to clean-webpack-plugin.
Use absolute patterns or ensure paths are relative to output.path.
Run npm install webpack-cleanup-plugin --save-dev
Use const WebpackCleanupPlugin = require('webpack-cleanup-plugin'); or import WebpackCleanupPlugin from 'webpack-cleanup-plugin';This plugin is separate: install and import webpack-cleanup-plugin.