MCPcopy
hub / github.com/webpack/webpack / onCompiled

Method onCompiled

lib/Compiler.js:584–656  ·  view source on GitHub ↗
(err, _compilation)

Source from the content-addressed store, hash-verified

582 * @returns {void}
583 */
584 const onCompiled = (err, _compilation) => {
585 if (err) return finalCallback(err);
586
587 const compilation = /** @type {Compilation} */ (_compilation);
588
589 if (this.hooks.shouldEmit.call(compilation) === false) {
590 compilation.startTime = startTime;
591 compilation.endTime = Date.now();
592 const stats = new Stats(compilation);
593 this.hooks.done.callAsync(stats, (err) => {
594 if (err) return finalCallback(err);
595 return finalCallback(null, stats);
596 });
597 return;
598 }
599
600 process.nextTick(() => {
601 logger = compilation.getLogger("webpack.Compiler");
602 logger.time("emitAssets");
603 this.emitAssets(compilation, (err) => {
604 /** @type {Logger} */
605 (logger).timeEnd("emitAssets");
606 if (err) return finalCallback(err);
607
608 if (compilation.hooks.needAdditionalPass.call()) {
609 compilation.needAdditionalPass = true;
610
611 compilation.startTime = startTime;
612 compilation.endTime = Date.now();
613 /** @type {Logger} */
614 (logger).time("done hook");
615 const stats = new Stats(compilation);
616 this.hooks.done.callAsync(stats, (err) => {
617 /** @type {Logger} */
618 (logger).timeEnd("done hook");
619 if (err) return finalCallback(err);
620
621 this.hooks.additionalPass.callAsync((err) => {
622 if (err) return finalCallback(err);
623 this.compile(onCompiled);
624 });
625 });
626 return;
627 }
628
629 /** @type {Logger} */
630 (logger).time("emitRecords");
631 this.emitRecords((err) => {
632 /** @type {Logger} */
633 (logger).timeEnd("emitRecords");
634 if (err) return finalCallback(err);
635
636 compilation.startTime = startTime;
637 compilation.endTime = Date.now();
638 /** @type {Logger} */
639 (logger).time("done hook");
640 const stats = new Stats(compilation);
641 this.hooks.done.callAsync(stats, (err) => {

Callers

nothing calls this directly

Calls 8

emitAssetsMethod · 0.95
compileMethod · 0.95
emitRecordsMethod · 0.95
timeMethod · 0.80
timeEndMethod · 0.80
getLoggerMethod · 0.65
callMethod · 0.45

Tested by

no test coverage detected