MinMaxSizeWarning.js 819 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const WebpackError = require("../WebpackError");
  7. const SizeFormatHelpers = require("../SizeFormatHelpers");
  8. class MinMaxSizeWarning extends WebpackError {
  9. constructor(keys, minSize, maxSize) {
  10. let keysMessage = "Fallback cache group";
  11. if (keys) {
  12. keysMessage =
  13. keys.length > 1
  14. ? `Cache groups ${keys.sort().join(", ")}`
  15. : `Cache group ${keys[0]}`;
  16. }
  17. super(
  18. `SplitChunksPlugin\n` +
  19. `${keysMessage}\n` +
  20. `Configured minSize (${SizeFormatHelpers.formatSize(minSize)}) is ` +
  21. `bigger than maxSize (${SizeFormatHelpers.formatSize(maxSize)}).\n` +
  22. "This seem to be a invalid optimiziation.splitChunks configuration."
  23. );
  24. }
  25. }
  26. module.exports = MinMaxSizeWarning;