webpack/lib/LoaderTargetPlugin.js

22 lines
469 B
JavaScript
Raw Normal View History

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
class LoaderTargetPlugin {
constructor(target) {
this.target = target;
}
apply(compiler) {
2017-12-06 22:01:25 +08:00
compiler.hooks.compilation.tap("LoaderTargetPlugin", (compilation) => {
compilation.hooks.normalModuleLoader.tap("LoaderTargetPlugin", (loaderContext) => {
loaderContext.target = this.target;
});
});
}
}
module.exports = LoaderTargetPlugin;