OsDependentRuleWarning.js 1.0 KB

12345678910111213141516171819202122232425262728293031
  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 OsDependentRuleWarning extends WebpackError {
  8. /**
  9. * Creates an instance of OsDependentRuleWarning.
  10. * @param {string[]} rules descriptions of the rules whose paths only match on one operating system
  11. */
  12. constructor(rules) {
  13. super(
  14. `webpack rule recommendations: \nThe following ${
  15. rules.length === 1
  16. ? "condition hardcodes a path separator, so it"
  17. : "conditions hardcode a path separator, so they"
  18. } only match on one operating system: ${rules.join(
  19. ", "
  20. )}.\nConditions are matched against native paths, which use '\\' on Windows and '/' elsewhere, so such a rule silently stops matching on the other one. Write '[\\\\/]' to accept both.\nFor more info visit https://webpack.js.org/configuration/module/#condition`
  21. );
  22. /** @type {string} */
  23. this.name = "OsDependentRuleWarning";
  24. }
  25. }
  26. module.exports = OsDependentRuleWarning;