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.
1 parent 9a72294 commit 9a1eca5Copy full SHA for 9a1eca5
lib/optimize/RemoveEmptyChunksPlugin.js
@@ -8,15 +8,16 @@ 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 => {
17
- chunk.remove("empty");
18
- chunks.splice(chunks.indexOf(chunk), 1);
19
- });
+ for (let i = chunks.length - 1; i >= 0; i--) {
+ const chunk = chunks[i];
+ if (
+ chunk.isEmpty() &&
+ !chunk.hasRuntime() &&
+ !chunk.hasEntryModule()
+ ) {
+ chunks.splice(i, 1);
+ }
20
21
};
22
compilation.hooks.optimizeChunksBasic.tap(
23
"RemoveEmptyChunksPlugin",
0 commit comments