source: frontend/node_modules/webpack/lib/performance/AssetsOverSizeLimitWarning.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 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
8const WebpackError = require("../errors/WebpackError");
9const formatSize = require("../util/formatSize");
10
11/** @typedef {import("./SizeLimitsPlugin").AssetDetails} AssetDetails */
12
13class AssetsOverSizeLimitWarning extends WebpackError {
14 /**
15 * Creates an instance of AssetsOverSizeLimitWarning.
16 * @param {AssetDetails[]} assetsOverSizeLimit the assets
17 * @param {number} assetLimit the size limit
18 */
19 constructor(assetsOverSizeLimit, assetLimit) {
20 const assetLists = assetsOverSizeLimit
21 .map((asset) => `\n ${asset.name} (${formatSize(asset.size)})`)
22 .join("");
23
24 super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize(
25 assetLimit
26 )}).
27This can impact web performance.
28Assets: ${assetLists}`);
29
30 /** @type {string} */
31 this.name = "AssetsOverSizeLimitWarning";
32 /** @type {AssetDetails[]} */
33 this.assets = assetsOverSizeLimit;
34 }
35}
36
37/** @type {typeof AssetsOverSizeLimitWarning} */
38module.exports = AssetsOverSizeLimitWarning;
Note: See TracBrowser for help on using the repository browser.