2014-04-09 15:12:04 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2017-01-19 11:28:55 +08:00
|
|
|
"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;
|
|
|
|
});
|
2017-01-19 11:28:55 +08:00
|
|
|
});
|
|
|
|
}
|
2014-04-09 15:12:04 +08:00
|
|
|
}
|
2017-01-19 11:28:55 +08:00
|
|
|
|
2014-04-09 15:12:04 +08:00
|
|
|
module.exports = LoaderTargetPlugin;
|