* @param {Webpack} webpack webpack * @param {Configuration} config configuration * @returns {Promise<void>} watching
(webpack, config)
| 402 | * @returns {Promise<void>} watching |
| 403 | */ |
| 404 | function runWebpack(webpack, config) { |
| 405 | return new Promise( |
| 406 | /** |
| 407 | * @param {(value: void) => void} resolve resolve |
| 408 | * @param {(err?: Error) => void} reject reject |
| 409 | */ |
| 410 | (resolve, reject) => { |
| 411 | const compiler = webpack(config); |
| 412 | compiler.run((err, stats) => { |
| 413 | if (err) return reject(err); |
| 414 | if (stats && (stats.hasWarnings() || stats.hasErrors())) { |
| 415 | return reject(new Error(stats.toString())); |
| 416 | } |
| 417 | |
| 418 | compiler.close((closeErr) => { |
| 419 | if (closeErr) return reject(closeErr); |
| 420 | if (stats) stats.toString(); class="cm">// Force stats computation |
| 421 | resolve(); |
| 422 | }); |
| 423 | }); |
| 424 | } |
| 425 | ); |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * @param {Webpack} webpack webpack |
no test coverage detected