mirror of https://github.com/webpack/webpack.git
refactor(es6) upgrade LoaderTargetPlugin to ES6 class
This commit is contained in:
parent
de9323f791
commit
c81507af2d
|
@ -2,15 +2,19 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
function LoaderTargetPlugin(target) {
|
||||
this.target = target;
|
||||
}
|
||||
module.exports = LoaderTargetPlugin;
|
||||
LoaderTargetPlugin.prototype.apply = function(compiler) {
|
||||
var target = this.target;
|
||||
compiler.plugin("compilation", function(compilation) {
|
||||
compilation.plugin("normal-module-loader", function(loaderContext) {
|
||||
loaderContext.target = target;
|
||||
"use strict";
|
||||
|
||||
class LoaderTargetPlugin {
|
||||
constructor(target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
let target = this.target;
|
||||
compiler.plugin("compilation", (compilation) => {
|
||||
compilation.plugin("normal-module-loader", (loaderContext) => loaderContext.target = target);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LoaderTargetPlugin;
|
||||
|
|
Loading…
Reference in New Issue