Last change
on this file since 59329aa was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
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 |
|
---|
8 | const { formatSize } = require("../SizeFormatHelpers");
|
---|
9 | const WebpackError = require("../WebpackError");
|
---|
10 |
|
---|
11 | /** @typedef {import("./SizeLimitsPlugin").EntrypointDetails} EntrypointDetails */
|
---|
12 |
|
---|
13 | module.exports = class EntrypointsOverSizeLimitWarning extends WebpackError {
|
---|
14 | /**
|
---|
15 | * @param {EntrypointDetails[]} entrypoints the entrypoints
|
---|
16 | * @param {number} entrypointLimit the size limit
|
---|
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 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.