Skip to content

Commit ce20a11

Browse files
committed
only warn if really watching
1 parent b93aacb commit ce20a11

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/CachePlugin.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ CachePlugin.prototype.apply = function(compiler) {
1818
} else {
1919
var _this = this;
2020
compiler.plugin("compilation", function(compilation) {
21-
if(compilation.notCacheable) {
22-
compilation.warnings.push(new Error("CachePlugin - Cache cannot be used because of: " + compilation.notCacheable))
23-
} else {
21+
if(!compilation.notCacheable) {
2422
compilation.cache = _this.cache;
23+
} else if(_this.watching) {
24+
compilation.warnings.push(
25+
new Error("CachePlugin - Cache cannot be used because of: " + compilation.notCacheable)
26+
);
2527
}
2628
});
29+
compiler.plugin("watch-run", function() {
30+
_this.watching = true;
31+
});
2732
compiler.plugin("run", function(compiler, callback) {
2833
if(!compiler._lastCompilationFileDependencies) return callback();
2934
var fs = compiler.inputFileSystem;

0 commit comments

Comments
 (0)