Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maartenstaa/webpack-cleanup-after-build-plugin
Cleans up files from the build folder left over from previous builds, e.g. in watch mode.
https://github.com/maartenstaa/webpack-cleanup-after-build-plugin
Last synced: about 2 months ago
JSON representation
Cleans up files from the build folder left over from previous builds, e.g. in watch mode.
- Host: GitHub
- URL: https://github.com/maartenstaa/webpack-cleanup-after-build-plugin
- Owner: MaartenStaa
- Created: 2018-06-29T08:09:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T01:38:36.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T13:09:36.847Z (3 months ago)
- Language: TypeScript
- Size: 594 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webpack cleanup after build plugin
This plugin is a Webpack 4 plugin that cleans up extraneous files from the output
directory. This is useful when running new builds or in watch mode, where new files
are created all the time, but you don't necessarily want all these old files to
stick around.The plugin runs at the end of the build (after Webpack finishes emitting files),
and removes files in the output folder that were not part of the completed compilation.## Usage
Just import the plugin and add it to your Webpack configuration.
```js
import { WebpackCleanupAfterBuildPlugin } from 'webpack-cleanup-after-build-plugin'export default {
plugins: [
new WebpackCleanupAfterBuildPlugin(options)
]
}
```## Options
You can optionally pass an options object to the plugin's constructor.
| Option name | Default | Description |
| -------------- | ------- | ----------- |
| filesToKeep | [] | A list of files to never delete. Relative paths are assumed to be relative to the output path. |
| ignoreDotFiles | true | Whether to ignore files and directories starting with a dot (".") |Example:
```js
new WebpackCleanupAfterBuildPlugin({
filesToKeep: [
'.mydotfile',
'not-generated-by-webpack.js'
],
ignoreDotFiles: false
})
```