Skip to content

Commit 5fde639

Browse files
authored
Merge pull request webpack#4033 from carloscuatin/refactor-loader-target-plugin
refactor(es6) upgrade LoaderTargetPlugin to ES6 class
2 parents 39a5f37 + c81507a commit 5fde639

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

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)