Skip to content

Commit 3f90c50

Browse files
authored
Merge pull request webpack#4359 from timse/nit-picks
Nit picks
2 parents 0f255ca + ff814e9 commit 3f90c50

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎lib/optimize/DedupePlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class DedupePlugin {
88
apply(compiler) {
99
compiler.plugin("compilation", (compilation) => {
10-
compilation.warnings.push(new Error("DedupePlugin: This plugin was removed from webpack. remove it from configuration."));
10+
compilation.warnings.push(new Error("DedupePlugin: This plugin was removed from webpack. Remove it from your configuration."));
1111
});
1212
}
1313
}

‎lib/optimize/FlagIncludedChunksPlugin.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ class FlagIncludedChunksPlugin {
1111
compilation.plugin("optimize-chunk-ids", (chunks) => {
1212
chunks.forEach((chunkA) => {
1313
chunks.forEach((chunkB) => {
14+
// as we iterate the same iterables twice
15+
// skip if we find ourselves
1416
if(chunkA === chunkB) return;
15-
// is chunkB in chunkA?
17+
18+
// instead of swapping A and B just bail
19+
// as we loop twice the current A will be B and B then A
1620
if(chunkA.modules.length < chunkB.modules.length) return;
21+
22+
// is chunkB in chunkA?
1723
for(let i = 0; i < chunkB.modules.length; i++) {
1824
if(chunkA.modules.indexOf(chunkB.modules[i]) < 0) return;
1925
}

‎lib/optimize/RemoveParentModulesPlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ class RemoveParentModulesPlugin {
6363
compilation.plugin(["optimize-chunks-basic", "optimize-extracted-chunks-basic"], (chunks) => {
6464
for(var index = 0; index < chunks.length; index++) {
6565
var chunk = chunks[index];
66+
if(chunk.parents.length === 0) continue;
6667

6768
// TODO consider Map when performance has improved https://gist.github.com/sokra/b36098368da7b8f6792fd7c85fca6311
6869
var cache = Object.create(null);
6970
var modules = chunk.modules.slice();
7071
for(var i = 0; i < modules.length; i++) {
7172
var module = modules[i];
7273

73-
if(chunk.parents.length === 0) continue;
7474
var dId = debugIds(module.chunks);
7575
var parentChunksWithModule;
7676
if((dId in cache) && dId !== "no") {

0 commit comments

Comments
 (0)