Registry / devops / webpack-clean

webpack-clean

JSON →
library1.2.5jsnpmunverified

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.

npm install webpack-clean
INSTALL
IMPORT
SIG · WEBPACK-CLEAN
W
webpack-clean
devopsjavascriptv1.2.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebpackCleanPlugin
const WebpackCleanPlugin = require('webpack-clean');
import WebpackCleanPlugin from 'webpack-clean';
Plugin uses CommonJS; ESM import may fail without default export.
WebpackCleanPlugin
const { WebpackCleanPlugin } = require('webpack-clean');
const WebpackCleanPlugin = require('webpack-clean').default;
Named export not available; use default export.
WebpackCleanPlugin
import WebpackCleanPlugin = require('webpack-clean');
TypeScript: use import = require() for CJS modules.

Basic usage of webpack-clean plugin with multiple files and removeMaps option in webpack config.

const WebpackCleanPlugin = require('webpack-clean'); const path = require('path'); module.exports = { context: path.join(__dirname, './'), entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') }, plugins: [ new WebpackCleanPlugin(['dist/test1.js', 'dist/test2.js'], { removeMaps: true }) ] };
Debug
Known issues
gotchaPlugin uses tapable plugin API which is deprecated in webpack 4; may show deprecation warnings.
fix
Upgrade to a modern alternative like clean-webpack-plugin.
affects: >=1.2.2
gotchaforceDelete option disabled by default; compile errors will stop deletion silently (logged to stdout).
fix
Set forceDelete: true in options to force deletion even on errors.
affects: >=1.2.3
deprecatedDeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead.
fix
The fix is included in version 1.2.2+; update to latest.
affects: 1.2.2
breakingCannot read property 'hasOwnProperty' of undefined error with webpack 4.43.0
fix
Upgrade to version 1.2.5.
affects: <=1.2.4
Errors
Common errors & fixes
TypeError: Cannot read property 'hasOwnProperty' of undefined
Bug with webpack 4.43.0 in versions <=1.2.4
fix
Update webpack-clean to 1.2.5.
DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
Using old plugin API in webpack 4.
fix
Update to webpack-clean 1.2.2+ or use a different clean plugin.
Error: Cannot find module 'winston-color'
Missing dependency when using npm <5 or manual install.
fix
Ensure webpack-clean 1.2.1+ is installed (winston-color moved to dependencies).
Upgrade
Version history
1.2.5latest on npm
Audit
Dependencies
winston-colorrequiredLogging dependency used by the plugin
Agent activity
16 hits · last 30 days
node
16
Resources
webpack-clean — npm install webpack-clean · libregistry