1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const { formatSize } = require("../SizeFormatHelpers");
|
9 | const WebpackError = require("../WebpackError");
|
10 |
|
11 |
|
12 |
|
13 | module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError {
|
14 | |
15 |
|
16 |
|
17 |
|
18 | constructor(entrypoints, entrypointLimit) {
|
19 | const entrypointList = entrypoints
|
20 | .map(
|
21 | entrypoint =>
|
22 | `\n ${entrypoint.name} (${formatSize(
|
23 | entrypoint.size
|
24 | )})\n${entrypoint.files.map(asset => ` ${asset}`).join("\n")}`
|
25 | )
|
26 | .join("");
|
27 | super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize(
|
28 | entrypointLimit
|
29 | )}). This can impact web performance.
|
30 | Entrypoints:${entrypointList}\n`);
|
31 |
|
32 | this.name = "EntrypointsOverSizeLimitWarning";
|
33 | this.entrypoints = entrypoints;
|
34 | }
|
35 | };
|