{"id":20720,"library":"webpack-clean-plugin","title":"webpack-clean-plugin","description":"A Webpack plugin for removing files and folders during the build process. Version 0.2.3, last release unknown (likely deprecated). Provides simple cleaning functionality on specified build hooks. Minimal configuration: only 'on' and 'path' options. Limited to removing files/folders, with no glob support, logging, or dry-run. Replaced by more modern tools like 'clean-webpack-plugin' or 'webpack-remove-files'.","status":"deprecated","version":"0.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/banama/webpack-clean-plugin","tags":["javascript","webpack"],"install":[{"cmd":"npm install webpack-clean-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-clean-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-clean-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Plugin is exported as named export in CommonJS. Default import pattern may work but named is correct.","wrong":"const WebpackCleanPlugin = require('webpack-clean-plugin');","symbol":"WebpackCleanPlugin","correct":"const { WebpackCleanPlugin } = require('webpack-clean-plugin');"},{"note":"Constructor expects a config object with 'on' (string) and 'path' (string or array).","wrong":"new webpackCleanPlugin({ on: 'emit', path: ['./dist'] })","symbol":"plugin instance","correct":"new WebpackCleanPlugin({ on: 'emit', path: ['./dist'] })"},{"note":"ESM import must use named import; no default export.","wrong":"import WebpackCleanPlugin from 'webpack-clean-plugin';","symbol":"WebpackCleanPlugin","correct":"import { WebpackCleanPlugin } from 'webpack-clean-plugin';"}],"quickstart":{"code":"const { WebpackCleanPlugin } = require('webpack-clean-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: { path: __dirname + '/dist' },\n  plugins: [\n    new WebpackCleanPlugin({\n      on: 'emit',\n      path: ['./dist']\n    })\n  ]\n};","lang":"javascript","description":"Basic Webpack configuration using webpack-clean-plugin to remove the dist folder on the emit hook."},"warnings":[{"fix":"Migrate to 'clean-webpack-plugin' (npm install clean-webpack-plugin --save-dev) and replace plugin import and instantiation.","message":"Package is unmaintained; last release 2016. Use clean-webpack-plugin or webpack-remove-files instead.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Use 'emit' or 'compile' for proper hook name.","message":"The 'on' option expects a Webpack hook name (e.g., 'emit', 'compilce' (typo)) but is case-sensitive; 'compilce' is documented but likely a typo for 'compile'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use clean-webpack-plugin with 'patterns' option or specify exact paths.","message":"Plugin does not support glob patterns; only literal paths. Attempting to use globs will delete nothing.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Switch to clean-webpack-plugin which supports async cleanup.","message":"Removal is synchronous and blocks Webpack; may cause issues on large builds.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install webpack-clean-plugin --save-dev","cause":"Package not installed.","error":"Error: Cannot find module 'webpack-clean-plugin'"},{"fix":"Use 'const { WebpackCleanPlugin } = require('webpack-clean-plugin');'","cause":"Incorrect import or require statement.","error":"TypeError: WebpackCleanPlugin is not a constructor"},{"fix":"Ensure path is absolute or relative to project root; use 'emit' hook.","cause":"Incorrect 'path' option (e.g., relative path not resolved) or wrong hook.","error":"No output files deleted"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}