Skip to content

Commit c81507a

Browse files
committed
refactor(es6) upgrade LoaderTargetPlugin to ES6 class
1 parent de9323f commit c81507a

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

‎lib/LoaderTargetPlugin.js‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
function LoaderTargetPlugin(target) {
6-
this.target = target;
5+
"use strict";
6+
7+
class LoaderTargetPlugin {
8+
constructor(target) {
9+
this.target = target;
10+
}
11+
12+
apply(compiler) {
13+
let target = this.target;
14+
compiler.plugin("compilation", (compilation) => {
15+
compilation.plugin("normal-module-loader", (loaderContext) => loaderContext.target = target);
16+
});
17+
}
718
}
19+
820
module.exports = LoaderTargetPlugin;
9-
LoaderTargetPlugin.prototype.apply = function(compiler) {
10-
var target = this.target;
11-
compiler.plugin("compilation", function(compilation) {
12-
compilation.plugin("normal-module-loader", function(loaderContext) {
13-
loaderContext.target = target;
14-
});
15-
});
16-
};

0 commit comments

Comments
 (0)