Skip to content

Commit 03ffa48

Browse files
authored
Merge pull request webpack#8639 from webpack/memory/limit-parallelism
Change forEach to forEachLimit when emitting assets
2 parents 2b2c17f + 80514cc commit 03ffa48

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

declarations.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ declare module "neo-async" {
7777
callback?: ErrorCallback<E>
7878
): void;
7979

80+
export function eachLimit<T, E>(
81+
arr: IterableCollection<T>,
82+
limit: number,
83+
iterator: AsyncIterator<T, E>,
84+
callback?: ErrorCallback<E>
85+
): void;
86+
8087
export function map<T, R, E>(
8188
arr: T[] | IterableIterator<T>,
8289
iterator: AsyncResultIterator<T, R, E>,
@@ -98,6 +105,7 @@ declare module "neo-async" {
98105
): void;
99106

100107
export const forEach: typeof each;
108+
export const forEachLimit: typeof eachLimit;
101109
}
102110

103111
// There are no typings for @webassemblyjs/ast

lib/Compiler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,9 @@ class Compiler extends Tapable {
312312
const emitFiles = err => {
313313
if (err) return callback(err);
314314

315-
asyncLib.forEach(
315+
asyncLib.forEachLimit(
316316
compilation.assets,
317+
15,
317318
(source, file, callback) => {
318319
let targetFile = file;
319320
const queryStringIdx = targetFile.indexOf("?");

0 commit comments

Comments
 (0)