{"id":20722,"library":"webpack-clean","title":"webpack-clean","description":"A webpack plugin to clean specified files after build. Current stable version is 1.2.5, released sporadically (last update 2020). It deletes specified files (and optionally their .map files) after each webpack build. Differentiators: simple API, optional forceDelete to proceed despite compile errors, and optional removeMaps to auto-delete source maps. Compared to clean-webpack-plugin, it is less maintained but offers direct file specification and force deletion.","status":"maintenance","version":"1.2.5","language":"javascript","source_language":"en","source_url":"https://github.com/allexcd/webpack-clean","tags":["javascript","webpack","clean","build"],"install":[{"cmd":"npm install webpack-clean","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-clean","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-clean","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Logging dependency used by the plugin","package":"winston-color","optional":false}],"imports":[{"note":"Plugin uses CommonJS; ESM import may fail without default export.","wrong":"import WebpackCleanPlugin from 'webpack-clean';","symbol":"WebpackCleanPlugin","correct":"const WebpackCleanPlugin = require('webpack-clean');"},{"note":"Named export not available; use default export.","wrong":"const WebpackCleanPlugin = require('webpack-clean').default;","symbol":"WebpackCleanPlugin","correct":"const { WebpackCleanPlugin } = require('webpack-clean');"},{"note":"TypeScript: use import = require() for CJS modules.","wrong":"","symbol":"WebpackCleanPlugin","correct":"import WebpackCleanPlugin = require('webpack-clean');"}],"quickstart":{"code":"const WebpackCleanPlugin = require('webpack-clean');\nconst path = require('path');\n\nmodule.exports = {\n  context: path.join(__dirname, './'),\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: path.resolve(__dirname, 'dist')\n  },\n  plugins: [\n    new WebpackCleanPlugin(['dist/test1.js', 'dist/test2.js'], { removeMaps: true })\n  ]\n};","lang":"javascript","description":"Basic usage of webpack-clean plugin with multiple files and removeMaps option in webpack config."},"warnings":[{"fix":"Upgrade to a modern alternative like clean-webpack-plugin.","message":"Plugin uses tapable plugin API which is deprecated in webpack 4; may show deprecation warnings.","severity":"gotcha","affected_versions":">=1.2.2"},{"fix":"Set forceDelete: true in options to force deletion even on errors.","message":"forceDelete option disabled by default; compile errors will stop deletion silently (logged to stdout).","severity":"gotcha","affected_versions":">=1.2.3"},{"fix":"The fix is included in version 1.2.2+; update to latest.","message":"DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead.","severity":"deprecated","affected_versions":"1.2.2"},{"fix":"Upgrade to version 1.2.5.","message":"Cannot read property 'hasOwnProperty' of undefined error with webpack 4.43.0","severity":"breaking","affected_versions":"<=1.2.4"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Update webpack-clean to 1.2.5.","cause":"Bug with webpack 4.43.0 in versions <=1.2.4","error":"TypeError: Cannot read property 'hasOwnProperty' of undefined"},{"fix":"Update to webpack-clean 1.2.2+ or use a different clean plugin.","cause":"Using old plugin API in webpack 4.","error":"DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead"},{"fix":"Ensure webpack-clean 1.2.1+ is installed (winston-color moved to dependencies).","cause":"Missing dependency when using npm <5 or manual install.","error":"Error: Cannot find module 'winston-color'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}