
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
webpack-clean
Advanced tools
A webpack plugin to clean specified files after build
Install the plugin:
npm install webpack-clean --save-dev
yarn add webpack-clean --dev
new WebpackCleanPlugin(files: array|string, [ { [basePath: string], [removeMaps: boolean] } ])
files - array of files or string for a single file relative to the basePath or to the context of your config (if the basePath param is not specified),basePath (optional) - string - directory to be resolved toremoveMaps (optional) - boolean - specify if the .map files should be automatically removed. Disabled by default.forceDelete (optional) - boolean - specify if the files should be force deleted in case of compile errors. If forceDelete is not enabled, the compile errors will be logged to stdout but the deletion of the files will not take place. Disabled by default.var WebpackCleanPlugin = require('webpack-clean');
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'
])
]
};
module.exports = {
plugins: [
new WebpackCleanPlugin(
'dist/fileA.js',
{basePath: path.join(__dirname, './')}
)
]
};
module.exports = {
plugins: [
new WebpackCleanPlugin([
'fileA.js',
'fileB.js'
], {basePath: path.join(__dirname, 'dist'))}
]
};
module.exports = {
plugins: [
new WebpackCleanPlugin([
'fileA.js',
'fileB.js'
], {basePath: path.join(__dirname, 'dist'), removeMaps: true)}
]
};
module.exports = {
plugins: [
new WebpackCleanPlugin([
'fileA.js',
'fileB.js'
], {basePath: path.join(__dirname, 'dist'), removeMaps: true, forceDelete: true)}
]
};
FAQs
A webpack plugin to clean specified files after build
We found that webpack-clean demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.