Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
922 bytes
|
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 { formatSize } = require("../SizeFormatHelpers");
|
---|
9 | const WebpackError = require("../WebpackError");
|
---|
10 |
|
---|
11 | /** @typedef {import("./SizeLimitsPlugin").AssetDetails} AssetDetails */
|
---|
12 |
|
---|
13 | module.exports = class AssetsOverSizeLimitWarning extends WebpackError {
|
---|
14 | /**
|
---|
15 | * @param {AssetDetails[]} assetsOverSizeLimit the assets
|
---|
16 | * @param {number} assetLimit the size limit
|
---|
17 | */
|
---|
18 | constructor(assetsOverSizeLimit, assetLimit) {
|
---|
19 | const assetLists = assetsOverSizeLimit
|
---|
20 | .map(asset => `\n ${asset.name} (${formatSize(asset.size)})`)
|
---|
21 | .join("");
|
---|
22 |
|
---|
23 | super(`asset size limit: The following asset(s) exceed the recommended size limit (${formatSize(
|
---|
24 | assetLimit
|
---|
25 | )}).
|
---|
26 | This can impact web performance.
|
---|
27 | Assets: ${assetLists}`);
|
---|
28 |
|
---|
29 | this.name = "AssetsOverSizeLimitWarning";
|
---|
30 | this.assets = assetsOverSizeLimit;
|
---|
31 | }
|
---|
32 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.