diff --git a/lib/CachePlugin.js b/lib/CachePlugin.js index 92c4bad16..19f73cf66 100644 --- a/lib/CachePlugin.js +++ b/lib/CachePlugin.js @@ -18,7 +18,11 @@ CachePlugin.prototype.apply = function(compiler) { } else { var _this = this; compiler.plugin("compilation", function(compilation) { - compilation.cache = _this.cache; + if(compilation.notCacheable) { + compilation.warnings.push(new Error("CachePlugin - Cache cannot be used because of: " + compilation.notCacheable)) + } else { + compilation.cache = _this.cache; + } }); compiler.plugin("run", function(compiler, callback) { if(!compiler._lastCompilationFileDependencies) return callback(); diff --git a/lib/optimize/DedupePlugin.js b/lib/optimize/DedupePlugin.js index 6635b03a7..1253b1d15 100644 --- a/lib/optimize/DedupePlugin.js +++ b/lib/optimize/DedupePlugin.js @@ -10,6 +10,7 @@ module.exports = DedupePlugin; DedupePlugin.prototype.apply = function(compiler) { compiler.plugin("compilation", function(compilation) { + compilation.notCacheable = "DedupePlugin"; compilation.dependencyTemplates.set(TemplateArgumentDependency, new TemplateArgumentDependency.Template());