Skip to content

Commit

Permalink
Refactor MovedToPluginWarningPlugin to es6 (#3789)
Browse files Browse the repository at this point in the history
* refactor of lib/MovedToPluginWarningPlugin to es6 syntax
  • Loading branch information
ritikrishu authored and TheLarkInn committed Jan 6, 2017
1 parent ab1999c commit c38e3ef
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions lib/MovedToPluginWarningPlugin.js
Expand Up @@ -2,18 +2,20 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function MovedToPluginWarningPlugin(optionName, pluginName) {
this.optionName = optionName;
this.pluginName = pluginName;
"use strict";
module.exports = class MovedToPluginWarningPlugin {
constructor(optionName, pluginName) {
this.optionName = optionName;
this.pluginName = pluginName;
}
apply(compiler) {
const optionName = this.optionName;
const pluginName = this.pluginName;
compiler.plugin("compilation", (compilation) => {
compilation.warnings.push(new Error `webpack options:
DEPRECATED option ${optionName} will be moved to the ${pluginName}.
Use this instead.
For more info about the usage of the ${pluginName} see https://webpack.github.io/docs/list-of-plugins.html`);
});
}
}
module.exports = MovedToPluginWarningPlugin;

MovedToPluginWarningPlugin.prototype.apply = function(compiler) {
var optionName = this.optionName;
var pluginName = this.pluginName;
compiler.plugin("compilation", function(compilation) {
compilation.warnings.push(new Error("webpack options:\nDEPRECATED option '" + optionName + "' will be moved to the " + pluginName + ". " +
"Use this instead.\n" +
"For more info about the usage of the " + pluginName + " see https://webpack.github.io/docs/list-of-plugins.html"));
});
};

0 comments on commit c38e3ef

Please sign in to comment.