# webpack-cleanup-plugin

> Plugin for webpack to cleanup extraneous files from the output path directory

Latest version **0.5.1** (published 2017-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-cleanup-plugin
pnpm add webpack-cleanup-plugin
yarn add webpack-cleanup-plugin
bun add webpack-cleanup-plugin
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.1 |
| Published | 2017-02-27 |
| First published | 2015-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/webpack-cleanup-plugin) |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+4 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 59 |
| Author | gpbl |
| Maintainers | gpbl |
| Keywords | webpack, webpack-plugin |

## Links

- npm: https://www.npmjs.com/package/webpack-cleanup-plugin
- Repository: https://github.com/gpbl/webpack-cleanup-plugin
- Homepage: https://github.com/gpbl/webpack-cleanup-plugin#readme
- Issues: https://github.com/gpbl/webpack-cleanup-plugin/issues
- npm.io page: https://npm.io/package/webpack-cleanup-plugin

## Dependencies (3)

- [minimatch](https://npm.io/package/minimatch.md) 3.0.3
- [lodash.union](https://npm.io/package/lodash.union.md) 4.6.0
- [recursive-readdir-sync](https://npm.io/package/recursive-readdir-sync.md) 1.0.6

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.5.1 (latest) — 2017-02-27
- 0.5.0 — 2017-02-27
- 0.4.2 — 2017-02-11
- 0.4.1 — 2016-10-13
- 0.4.0 — 2016-09-18
- 0.3.1 — 2016-08-31
- 0.3.0 — 2016-08-20
- 0.2.0 — 2016-02-13
- 0.1.1 — 2015-08-25
- 0.1.0 — 2015-08-25

## README

# webpack-cleanup-plugin

This [webpack](http://webpack.github.io) plugin cleans up the extraneous files
from the webpack's output path.

Since it runs when the compile process is finished, it is useful when building
on production to remove the assets created by previous builds.

```
npm install webpack-cleanup-plugin --save-dev
```

[![npm version](https://img.shields.io/npm/v/webpack-cleanup-plugin.svg?style=flat-square)](https://www.npmjs.com/package/webpack-cleanup-plugin)
[![npm downloads](https://img.shields.io/npm/dm/webpack-cleanup-plugin.svg?style=flat-square)](http://npm-stat.com/charts.html?package=webpack-cleanup-plugin)
[![Build Status](https://img.shields.io/travis/gpbl/webpack-cleanup-plugin.svg?style=flat-square)](https://travis-ci.org/gpbl/webpack-cleanup-plugin)

⚠️ **Beware!** This plugins actually delete files. Make sure it's safe for your app
to delete files not generated by webpack. Use the `exclude` option if you want to
keep files that are not webpack assets.

## Usage

Install via npm:

```
npm install webpack-cleanup-plugin --save-dev
```

Then add the plugin to the `plugins` array in your webpack's config, e.g.:

```js
// webpack.config.js
import WebpackCleanupPlugin from 'webpack-cleanup-plugin';
const config = {
  output: {
    path: "/my/output/path"
  },
  // ...
  plugins: [
    new WebpackCleanupPlugin()
  ]
}
export default config;
```

### Options

* If you want to keep some files in the output path, e.g. a `stats.json` file generated from some other
plugins, use the **`exclude`** Array option. It accepts globbing as in [minimatch](https://github.com/isaacs/minimatch).

```js
// Do not delete `stats.json`, `important.json`, and everything in `folder`
new WebpackCleanupPlugin({
  exclude: ["stats.json", "important.js", "folder/**/*"],
})
```

* To mute the console output, use the **`quiet`** option:

```js
new WebpackCleanupPlugin({
  quiet: true,
})
```

* To print the list of the files that will be deleted without actually deleting them, use the **`preview`** option:

```js
new WebpackCleanupPlugin({
  preview: true,
})
```

---
_Source: https://npm.io/package/webpack-cleanup-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
