WarnNoModeSetPlugin.js 579 B

123456789101112131415161718192021222324252627
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const NoModeWarning = require("./NoModeWarning");
  7. /** @typedef {import("./Compiler")} Compiler */
  8. const PLUGIN_NAME = "WarnNoModeSetPlugin";
  9. class WarnNoModeSetPlugin {
  10. /**
  11. * Apply the plugin
  12. * @param {Compiler} compiler the compiler instance
  13. * @returns {void}
  14. */
  15. apply(compiler) {
  16. compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
  17. compilation.warnings.push(new NoModeWarning());
  18. });
  19. }
  20. }
  21. module.exports = WarnNoModeSetPlugin;