{"id":15282548,"url":"https://github.com/chrisblossom/clean-self-webpack-plugin","last_synced_at":"2025-10-06T23:30:38.344Z","repository":{"id":57199761,"uuid":"94154911","full_name":"chrisblossom/clean-self-webpack-plugin","owner":"chrisblossom","description":"A webpack plugin to remove files created by webpack","archived":true,"fork":false,"pushed_at":"2019-03-04T19:43:43.000Z","size":186,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-21T10:06:29.623Z","etag":null,"topics":["build-automation","clean","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/clean-self-webpack-plugin","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisblossom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-13T01:11:49.000Z","updated_at":"2023-01-28T18:53:27.000Z","dependencies_parsed_at":"2022-09-12T23:50:35.209Z","dependency_job_id":null,"html_url":"https://github.com/chrisblossom/clean-self-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisblossom%2Fclean-self-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisblossom%2Fclean-self-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisblossom%2Fclean-self-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisblossom%2Fclean-self-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisblossom","download_url":"https://codeload.github.com/chrisblossom/clean-self-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235059318,"owners_count":18929286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-automation","clean","webpack","webpack-plugin"],"created_at":"2024-09-30T14:26:53.083Z","updated_at":"2025-10-06T23:30:38.021Z","avatar_url":"https://github.com/chrisblossom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e This module has been deprecated because it has been merged with [johnagan/clean-webpack-plugin](https://github.com/johnagan/clean-webpack-plugin).\n\n# clean-self-webpack-plugin\n\n[![npm](https://img.shields.io/npm/v/clean-self-webpack-plugin.svg?label=npm%20version)](https://www.npmjs.com/package/clean-self-webpack-plugin)\n[![Linux Build Status](https://img.shields.io/circleci/project/github/chrisblossom/clean-self-webpack-plugin/master.svg?label=linux%20build)](https://circleci.com/gh/chrisblossom/clean-self-webpack-plugin/tree/master)\n[![Windows Build Status](https://img.shields.io/appveyor/ci/chrisblossom/clean-self-webpack-plugin/master.svg?label=windows%20build)](https://ci.appveyor.com/project/chrisblossom/clean-self-webpack-plugin/branch/master)\n[![Code Coverage](https://img.shields.io/codecov/c/github/chrisblossom/clean-self-webpack-plugin/master.svg)](https://codecov.io/gh/chrisblossom/clean-self-webpack-plugin/branch/master)\n\nWebpack plugin to delete extraneous files created by Webpack\n\n\u003e NOTE: Node v6+ and Webpack v2+ are supported and tested.\n\n## About\n\nBy default, this plugin will only remove files created by Webpack after compilation has completed.\nZero config required. Although it can be configured to remove other files, it is not recommended.\n\n## Installation\n\n`npm install --save-dev clean-self-webpack-plugin`\n\n## Usage\n\n```js\nimport webpack from 'webpack';\nimport path from 'path';\nimport del from 'del';\nimport CleanSelfWebpackPlugin from 'clean-self-webpack-plugin';\n\nconst outputPath = path.resolve(process.cwd(), 'build');\n\n/*\n * Remove project files before webpack is loaded.\n * Be sure it is not async.\n *\n * It is HIGHLY recommended to handle the initial\n * build directory clean outside of this plugin / webpack.\n *\n * Popular existing packages:\n * https://github.com/isaacs/rimraf\n * https://github.com/sindresorhus/del\n *    -- I prefer this one, great glob support and has CLI (del-cli package)\n * https://github.com/jprichardson/node-fs-extra\n *\n */\ndel.sync([path.resolve(outputPath, '**/*')]);\n\nconst webpackConfig = {\n    entry: path.resolve(process.cwd(), 'src/index.js'),\n    output: {\n        path: outputPath,\n        filename: 'bundle.js',\n    },\n    plugins: [new CleanSelfWebpackPlugin()],\n};\n\nexport default webpackConfig;\n```\n\n## Options\n\n```js\nnew CleanSelfWebpackPlugin({\n    /**\n     * Simulate the removal of files\n     *\n     * default: false\n     */\n    dryRun: true,\n\n    /**\n     * Write Logs to Console\n     * (Always enabled when dryRun is true)\n     *\n     * default: false\n     */\n    verbose: true,\n\n    /**\n     * **WARNING**\n     *\n     * Notes on the below options customPatterns and initialPatterns:\n     *\n     * Neither of these options are recommended.\n     * Use only if you know what you are doing.\n     *\n     * They are unsafe...so test initially with dryRun: true.\n     *\n     * Relative to Webpack's output.path directory.\n     * If outside of webpack's output.path directory,\n     *    use path.resolve(process.cwd(), '')\n     *\n     * These options extend del's pattern matching API.\n     * See https://github.com/sindresorhus/del#patterns\n     *    for pattern matching documentation\n     */\n\n    /**\n     * Custom pattern matching\n     *\n     * Removes files on after every build that match this pattern.\n     * Used for files that are not created directly by Webpack.\n     *\n     * default: disabled\n     */\n    customPatterns: ['static*.*', '!static1.js'],\n\n    /**\n     * Removes files once prior to Webpack compilation\n     *\n     * Again, this should be handled outside of Webpack.\n     * See Usage example.\n     *\n     * NOTE: customPatterns ARE included with this\n     *\n     * default: disabled\n     */\n    initialPatterns: ['**'],\n});\n```\n\n## Thanks To / Related Projects\n\nThis package was created with the great work / lessons learned from:\n\n-   [johnagan/clean-webpack-plugin](https://github.com/johnagan/clean-webpack-plugin)\n-   [gpbl/webpack-cleanup-plugin](https://github.com/gpbl/webpack-cleanup-plugin)\n-   [sindresorhus/del](https://github.com/sindresorhus/del)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisblossom%2Fclean-self-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisblossom%2Fclean-self-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisblossom%2Fclean-self-webpack-plugin/lists"}