Skip to content

Commit 36cea59

Browse files
committed
further reduce usage of let in Compilation
1 parent 8ca8904 commit 36cea59

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎lib/Compilation.js‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -685,17 +685,16 @@ class Compilation extends Tapable {
685685
}
686686

687687
addChunk(name, module, loc) {
688-
let chunk;
689688
if(name) {
690689
if(Object.prototype.hasOwnProperty.call(this.namedChunks, name)) {
691-
chunk = this.namedChunks[name];
690+
const chunk = this.namedChunks[name];
692691
if(module) {
693692
chunk.addOrigin(module, loc);
694693
}
695694
return chunk;
696695
}
697696
}
698-
chunk = new Chunk(name, module, loc);
697+
const chunk = new Chunk(name, module, loc);
699698
this.chunks.push(chunk);
700699
if(name) {
701700
this.namedChunks[name] = chunk;
@@ -1098,7 +1097,6 @@ class Compilation extends Tapable {
10981097
this.children.forEach(function(child) {
10991098
hash.update(child.hash);
11001099
});
1101-
let chunk;
11021100
// clone needed as sort below is inplace mutation
11031101
const chunks = this.chunks.slice();
11041102
/**
@@ -1114,7 +1112,7 @@ class Compilation extends Tapable {
11141112
return 0;
11151113
});
11161114
for(let i = 0; i < chunks.length; i++) {
1117-
chunk = chunks[i];
1115+
const chunk = chunks[i];
11181116
const chunkHash = crypto.createHash(hashFunction);
11191117
if(outputOptions.hashSalt)
11201118
chunkHash.update(outputOptions.hashSalt);
@@ -1146,16 +1144,14 @@ class Compilation extends Tapable {
11461144
}
11471145

11481146
createModuleAssets() {
1149-
let module;
1150-
11511147
function cacheAssetsAndApplyPlugins(name) {
11521148
const file = this.getPath(name);
11531149
this.assets[file] = module.assets[name];
11541150
this.applyPlugins2("module-asset", module, file);
11551151
}
11561152

11571153
for(let i = 0; i < this.modules.length; i++) {
1158-
module = this.modules[i];
1154+
const module = this.modules[i];
11591155
if(module.assets) {
11601156
Object.keys(module.assets).forEach(cacheAssetsAndApplyPlugins, this);
11611157
}

0 commit comments

Comments
 (0)