MCPcopy
hub / github.com/webpack/webpack / runWebpack

Function runWebpack

test/BenchmarkTestCases.benchmark.mjs:404–426  ·  test/BenchmarkTestCases.benchmark.mjs::runWebpack

* @param {Webpack} webpack webpack * @param {Configuration} config configuration * @returns {Promise<void>} watching

(webpack, config)

Source from the content-addressed store, hash-verified

402 * @returns {Promise<void>} watching
403 */
404function 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

Callers 1

registerSuiteFunction · 0.85

Calls 7

resolveFunction · 0.85
webpackFunction · 0.50
runMethod · 0.45
hasWarningsMethod · 0.45
hasErrorsMethod · 0.45
toStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected