Skip to content

Commit 8f9401a

Browse files
committed
remove notCacheable
1 parent a4d63e4 commit 8f9401a

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

lib/CachePlugin.js

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,19 @@ class CachePlugin {
2020
} else {
2121
const registerCacheToCompiler = (compiler, cache) => {
2222
compiler.plugin("this-compilation", compilation => {
23-
// TODO remove notCacheable for webpack 4
24-
if(!compilation.notCacheable) {
25-
compilation.cache = cache;
26-
compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
27-
if(cache) {
28-
let childCache;
29-
if(!cache.children) cache.children = {};
30-
if(!cache.children[compilerName]) cache.children[compilerName] = [];
31-
if(cache.children[compilerName][compilerIndex])
32-
childCache = cache.children[compilerName][compilerIndex];
33-
else
34-
cache.children[compilerName].push(childCache = {});
35-
registerCacheToCompiler(childCompiler, childCache);
36-
}
37-
});
38-
} else if(this.watching) {
39-
compilation.warnings.push(
40-
new Error(`CachePlugin - Cache cannot be used because of: ${compilation.notCacheable}`)
41-
);
42-
}
23+
compilation.cache = cache;
24+
compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
25+
if(cache) {
26+
let childCache;
27+
if(!cache.children) cache.children = {};
28+
if(!cache.children[compilerName]) cache.children[compilerName] = [];
29+
if(cache.children[compilerName][compilerIndex])
30+
childCache = cache.children[compilerName][compilerIndex];
31+
else
32+
cache.children[compilerName].push(childCache = {});
33+
registerCacheToCompiler(childCompiler, childCache);
34+
}
35+
});
4336
});
4437
};
4538
registerCacheToCompiler(compiler, this.cache);

0 commit comments

Comments
 (0)