Merge pull request #10343 from webpack/compat/cache-readonly

make compiler/compilation.cache read-only
This commit is contained in:
Tobias Koppers 2020-02-05 09:20:11 +01:00 committed by GitHub
commit 98cf565c5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -505,6 +505,11 @@ class Compilation {
this.requestShortener = compiler.requestShortener; this.requestShortener = compiler.requestShortener;
this.compilerPath = compiler.compilerPath; this.compilerPath = compiler.compilerPath;
this.cache = compiler.cache; this.cache = compiler.cache;
// Make this.cache readonly, to make it easier to find incompatible plugins
Object.defineProperty(this, "cache", {
writable: false,
value: this.cache
});
this.logger = this.getLogger("webpack.Compilation"); this.logger = this.getLogger("webpack.Compilation");

View File

@ -212,6 +212,11 @@ class Compiler {
this.requestShortener = new RequestShortener(context, this.root); this.requestShortener = new RequestShortener(context, this.root);
this.cache = new Cache(); this.cache = new Cache();
// Make this.cache readonly, to make it easier to find incompatible plugins
Object.defineProperty(this, "cache", {
writable: false,
value: this.cache
});
this.compilerPath = ""; this.compilerPath = "";