Skip to content

Commit

Permalink
Dont use "beforeEmit" option in watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisschrijver committed Jan 26, 2018
1 parent a2f6a12 commit 93cd388
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ CleanWebpackPlugin.prototype.apply = function(compiler) {
compiler.plugin("compile", function(params) {
clean.call(_this);
});
} else if (_this.options.beforeEmit) {
} else if (_this.options.beforeEmit && !compiler.options.watch) {
compiler.plugin("emit", function(compilation, callback) {
clean.call(_this);

Expand Down

1 comment on commit 93cd388

@paynecodes
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisSchrijver

I'm wondering if there is something else that can be done here to get the best of both worlds. Something like the following.

During initial compilation, clean on emit, but during recompile while !!compiler.options.watch === true don't clean.

Please sign in to comment.