We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9a72294 + 8d1d569 commit c39c963Copy full SHA for c39c963
lib/optimize/RemoveEmptyChunksPlugin.js
@@ -8,15 +8,17 @@ class RemoveEmptyChunksPlugin {
8
apply(compiler) {
9
compiler.hooks.compilation.tap("RemoveEmptyChunksPlugin", compilation => {
10
const handler = chunks => {
11
- chunks
12
- .filter(
13
- chunk =>
14
- chunk.isEmpty() && !chunk.hasRuntime() && !chunk.hasEntryModule()
15
- )
16
- .forEach(chunk => {
+ for (let i = chunks.length - 1; i >= 0; i--) {
+ const chunk = chunks[i];
+ if (
+ chunk.isEmpty() &&
+ !chunk.hasRuntime() &&
+ !chunk.hasEntryModule()
17
+ ) {
18
chunk.remove("empty");
- chunks.splice(chunks.indexOf(chunk), 1);
19
- });
+ chunks.splice(i, 1);
20
+ }
21
22
};
23
compilation.hooks.optimizeChunksBasic.tap(
24
"RemoveEmptyChunksPlugin",
0 commit comments