Skip to content

Commit c38e3ef

Browse files
ritikrishuTheLarkInn
authored andcommitted
Refactor MovedToPluginWarningPlugin to es6 (webpack#3789)
* refactor of lib/MovedToPluginWarningPlugin to es6 syntax
1 parent ab1999c commit c38e3ef

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

lib/MovedToPluginWarningPlugin.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
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+
}
821
}
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

Comments
 (0)