UnusedExternalsWarning.js 993 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 UnusedExternalsWarning extends WebpackError {
  8. /**
  9. * Creates an instance of UnusedExternalsWarning.
  10. * @param {string[]} requests the external requests nothing imported
  11. */
  12. constructor(requests) {
  13. super(
  14. `webpack externals recommendations: \nThe following ${
  15. requests.length === 1 ? "external was" : "externals were"
  16. } declared but never imported: ${requests.join(
  17. ", "
  18. )}.\nAn external that nothing requests is usually a typo in the request, or a leftover from a dependency that is now bundled. It also hides a real import behind the wrong name, which then gets bundled instead of staying external.\nFor more info visit https://webpack.js.org/configuration/externals/`
  19. );
  20. /** @type {string} */
  21. this.name = "UnusedExternalsWarning";
  22. }
  23. }
  24. module.exports = UnusedExternalsWarning;