UnusedDefinesWarning.js 949 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Alexander Akait @alexander-akait
  4. */
  5. "use strict";
  6. const WebpackError = require("./WebpackError");
  7. class UnusedDefinesWarning extends WebpackError {
  8. /**
  9. * Creates an instance of UnusedDefinesWarning.
  10. * @param {string[]} keys the define keys nothing referenced
  11. */
  12. constructor(keys) {
  13. super(
  14. `webpack define recommendations: \nThe following ${
  15. keys.length === 1 ? "key was" : "keys were"
  16. } defined but never referenced by any module: ${keys.join(
  17. ", "
  18. )}.\nA key that substitutes nothing is usually a typo, or a leftover from code that no longer reads it. Every key still costs a parser hook on each module, and changing its value invalidates the build for nothing.\nFor more info visit https://webpack.js.org/plugins/define-plugin/`
  19. );
  20. /** @type {string} */
  21. this.name = "UnusedDefinesWarning";
  22. }
  23. }
  24. module.exports = UnusedDefinesWarning;