You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AssetsOverSizeLimitWarning.js 837B

123456789101112131415161718192021222324252627282930
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Sean Larkin @thelarkinn
  4. */
  5. "use strict";
  6. const WebpackError = require("../WebpackError");
  7. const SizeFormatHelpers = require("../SizeFormatHelpers");
  8. module.exports = class AssetsOverSizeLimitWarning extends WebpackError {
  9. constructor(assetsOverSizeLimit, assetLimit) {
  10. const assetLists = assetsOverSizeLimit
  11. .map(
  12. asset =>
  13. `\n ${asset.name} (${SizeFormatHelpers.formatSize(asset.size)})`
  14. )
  15. .join("");
  16. super(`asset size limit: The following asset(s) exceed the recommended size limit (${SizeFormatHelpers.formatSize(
  17. assetLimit
  18. )}).
  19. This can impact web performance.
  20. Assets: ${assetLists}`);
  21. this.name = "AssetsOverSizeLimitWarning";
  22. this.assets = assetsOverSizeLimit;
  23. Error.captureStackTrace(this, this.constructor);
  24. }
  25. };