* Apply on multi compiler. * @param {MultiCompiler} compiler webpack multi-compiler * @param {HandlerFn} handler function that executes for every progress step * @returns {void}
(compiler, handler)
| 294 | * @returns {void} |
| 295 | */ |
| 296 | _applyOnMultiCompiler(compiler, handler) { |
| 297 | const states = compiler.compilers.map( |
| 298 | () => /** @type {[number, ...string[]]} */ ([0]) |
| 299 | ); |
| 300 | for (const [idx, item] of compiler.compilers.entries()) { |
| 301 | new ProgressPlugin((p, msg, ...args) => { |
| 302 | states[idx] = [p, msg, ...args]; |
| 303 | let sum = 0; |
| 304 | for (const [p] of states) sum += p; |
| 305 | handler(sum / states.length, `[${idx}] ${msg}`, ...args); |
| 306 | }).apply(item); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Processes the provided compiler. |