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

Method onCompiled

lib/Watching.js:203–249  ·  view source on GitHub ↗
(err, _compilation)

Source from the content-addressed store, hash-verified

201 * @returns {void}
202 */
203 const onCompiled = (err, _compilation) => {
204 if (err) return this._done(err, _compilation);
205
206 const compilation = /** @type {Compilation} */ (_compilation);
207
208 if (this.compiler.hooks.shouldEmit.call(compilation) === false) {
209 return this._done(null, compilation);
210 }
211
212 process.nextTick(() => {
213 const logger = compilation.getLogger("webpack.Compiler");
214 logger.time("emitAssets");
215 this.compiler.emitAssets(compilation, (err) => {
216 logger.timeEnd("emitAssets");
217 if (err) return this._done(err, compilation);
218 if (this.invalid) return this._done(null, compilation);
219
220 logger.time("emitRecords");
221 this.compiler.emitRecords((err) => {
222 logger.timeEnd("emitRecords");
223 if (err) return this._done(err, compilation);
224
225 if (compilation.hooks.needAdditionalPass.call()) {
226 compilation.needAdditionalPass = true;
227
228 compilation.startTime = /** @type {number} */ (
229 this.startTime
230 );
231 compilation.endTime = Date.now();
232 logger.time("done hook");
233 const stats = new Stats(compilation);
234 this.compiler.hooks.done.callAsync(stats, (err) => {
235 logger.timeEnd("done hook");
236 if (err) return this._done(err, compilation);
237
238 this.compiler.hooks.additionalPass.callAsync((err) => {
239 if (err) return this._done(err, compilation);
240 this.compiler.compile(onCompiled);
241 });
242 });
243 return;
244 }
245 return this._done(null, compilation);
246 });
247 });
248 });
249 };
250 this.compiler.compile(onCompiled);
251 });
252 };

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected