|
2 | 2 | MIT License http://www.opensource.org/licenses/mit-license.php |
3 | 3 | Author Tobias Koppers @sokra |
4 | 4 | */ |
5 | | -function MovedToPluginWarningPlugin(optionName, pluginName) { |
6 | | - this.optionName = optionName; |
7 | | - this.pluginName = pluginName; |
| 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.github.io/docs/list-of-plugins.html`); |
| 19 | + }); |
| 20 | + } |
8 | 21 | } |
9 | | -module.exports = MovedToPluginWarningPlugin; |
10 | | - |
11 | | -MovedToPluginWarningPlugin.prototype.apply = function(compiler) { |
12 | | - var optionName = this.optionName; |
13 | | - var pluginName = this.pluginName; |
14 | | - compiler.plugin("compilation", function(compilation) { |
15 | | - compilation.warnings.push(new Error("webpack options:\nDEPRECATED option '" + optionName + "' will be moved to the " + pluginName + ". " + |
16 | | - "Use this instead.\n" + |
17 | | - "For more info about the usage of the " + pluginName + " see https://webpack.github.io/docs/list-of-plugins.html")); |
18 | | - }); |
19 | | -}; |
|
0 commit comments