|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Sean Larkin @thelarkinn
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const WebpackError = require("../errors/WebpackError");
|
|---|
| 9 | const formatSize = require("../util/formatSize");
|
|---|
| 10 |
|
|---|
| 11 | /** @typedef {import("./SizeLimitsPlugin").EntrypointDetails} EntrypointDetails */
|
|---|
| 12 |
|
|---|
| 13 | class EntrypointsOverSizeLimitWarning extends WebpackError {
|
|---|
| 14 | /**
|
|---|
| 15 | * Creates an instance of EntrypointsOverSizeLimitWarning.
|
|---|
| 16 | * @param {EntrypointDetails[]} entrypoints the entrypoints
|
|---|
| 17 | * @param {number} entrypointLimit the size limit
|
|---|
| 18 | */
|
|---|
| 19 | constructor(entrypoints, entrypointLimit) {
|
|---|
| 20 | const entrypointList = entrypoints
|
|---|
| 21 | .map(
|
|---|
| 22 | (entrypoint) =>
|
|---|
| 23 | `\n ${entrypoint.name} (${formatSize(
|
|---|
| 24 | entrypoint.size
|
|---|
| 25 | )})\n${entrypoint.files.map((asset) => ` ${asset}`).join("\n")}`
|
|---|
| 26 | )
|
|---|
| 27 | .join("");
|
|---|
| 28 | super(`entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (${formatSize(
|
|---|
| 29 | entrypointLimit
|
|---|
| 30 | )}). This can impact web performance.
|
|---|
| 31 | Entrypoints:${entrypointList}\n`);
|
|---|
| 32 |
|
|---|
| 33 | /** @type {string} */
|
|---|
| 34 | this.name = "EntrypointsOverSizeLimitWarning";
|
|---|
| 35 | /** @type {EntrypointDetails[]} */
|
|---|
| 36 | this.entrypoints = entrypoints;
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | /** @type {typeof EntrypointsOverSizeLimitWarning} */
|
|---|
| 41 | module.exports = EntrypointsOverSizeLimitWarning;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.