MCPcopy
hub / github.com/webpack/webpack-dev-server / warnings

Function warnings

client-src/index.js:507–547  ·  view source on GitHub ↗

* @param {Error[]} warnings warnings * @param {{ preventReloading: boolean }=} params extra params

(warnings, params)

Source from the content-addressed store, hash-verified

505 * @param {{ preventReloading: boolean }=} params extra params
506 */
507 warnings(warnings, params) {
508 log.warn("Warnings while compiling.");
509
510 const printableWarnings = warnings.map((error) => {
511 const { header, body } = formatProblem("warning", error);
512
513 return `${header}\n${stripAnsi(body)}`;
514 });
515
516 sendMessage("Warnings", printableWarnings);
517
518 for (let i = 0; i < printableWarnings.length; i++) {
519 log.warn(printableWarnings[i]);
520 }
521
522 const overlayWarningsSetting =
523 typeof options.overlay === "boolean"
524 ? options.overlay
525 : options.overlay && options.overlay.warnings;
526
527 if (overlayWarningsSetting) {
528 const warningsToDisplay =
529 typeof overlayWarningsSetting === "function"
530 ? warnings.filter(overlayWarningsSetting)
531 : warnings;
532
533 if (warningsToDisplay.length) {
534 overlay.send({
535 type: "BUILD_ERROR",
536 level: "warning",
537 messages: warnings,
538 });
539 }
540 }
541
542 if (params && params.preventReloading) {
543 return;
544 }
545
546 reloadApp(options, status);
547 },
548 /**
549 * @param {Error[]} errors errors
550 */

Callers

nothing calls this directly

Calls 3

formatProblemFunction · 0.90
stripAnsiFunction · 0.85
reloadAppFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…