MovedToPluginWarningPlugin.js 695 B

123456789101112131415161718192021
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = class MovedToPluginWarningPlugin {
  7. constructor(optionName, pluginName) {
  8. this.optionName = optionName;
  9. this.pluginName = pluginName;
  10. }
  11. apply(compiler) {
  12. const optionName = this.optionName;
  13. const pluginName = this.pluginName;
  14. compiler.plugin("compilation", (compilation) => {
  15. compilation.warnings.push(new Error `webpack options:
  16. DEPRECATED option ${optionName} will be moved to the ${pluginName}.
  17. Use this instead.
  18. For more info about the usage of the ${pluginName} see https://webpack.js.org/plugins/`);
  19. });
  20. }
  21. };