Skip to content

Commit

Permalink
do not include customPatterns in initialPatterns
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisblossom committed Mar 4, 2019
1 parent 3830778 commit 5e5a519
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -83,8 +83,6 @@ new CleanWebpackPlugin({
* Removes files once prior to Webpack compilation
* Not included in rebuilds (watch mode)
*
* NOTE: customPatterns are included with this
*
* Use !negative patterns to exclude files
*
* default: ['**']
Expand Down
4 changes: 2 additions & 2 deletions src/clean-webpack-plugin.test.ts
Expand Up @@ -535,7 +535,6 @@ describe('customPatterns option', () => {
expect(sandbox.getFileListSync(outputPathFull)).toEqual([
'1.bundle.js',
'bundle.js',
'static1.js',
]);

createSrcBundle(1);
Expand Down Expand Up @@ -593,7 +592,8 @@ describe('dangerouslyAllowCleanPatternsOutsideProject option', () => {
expect(initialOutsideFiles).toEqual(['outside-file.js']);

const cleanWebpackPlugin = new CleanWebpackPlugin({
customPatterns: [path.join(sandbox.dir, 'build/**')],
// Use initialPatterns because webpack 2/3 doesn't handle errors in done lifecycle correctly
initialPatterns: [path.join(sandbox.dir, 'build/**')],
});

const compiler = webpack({
Expand Down
4 changes: 1 addition & 3 deletions src/clean-webpack-plugin.ts
Expand Up @@ -34,8 +34,6 @@ interface Options {
* Removes files once prior to Webpack compilation
* Not included in rebuilds (watch mode)
*
* NOTE: customPatterns are included with this
*
* Use !negative patterns to exclude files
*
* default: ['**']
Expand Down Expand Up @@ -180,7 +178,7 @@ class CleanWebpackPlugin {

this.initialClean = true;

this.removeFiles([...this.initialPatterns, ...this.customPatterns]);
this.removeFiles(this.initialPatterns);
}

handleDone(stats: Stats) {
Expand Down

0 comments on commit 5e5a519

Please sign in to comment.