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
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||||
Author Tobias Koppers @sokra
|
Author Tobias Koppers @sokra
|
||||||
*/
|
*/
|
||||||
function LoaderTargetPlugin(target) {
|
"use strict";
|
||||||
this.target = target;
|
|
||||||
}
|
class LoaderTargetPlugin {
|
||||||
module.exports = LoaderTargetPlugin;
|
constructor(target) {
|
||||||
LoaderTargetPlugin.prototype.apply = function(compiler) {
|
this.target = target;
|
||||||
var target = this.target;
|
}
|
||||||
compiler.plugin("compilation", function(compilation) {
|
|
||||||
compilation.plugin("normal-module-loader", function(loaderContext) {
|
apply(compiler) {
|
||||||
loaderContext.target = target;
|
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