1 |
9bb1e829
|
cagy
|
/*
|
2 |
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3 |
|
|
Author Tobias Koppers @sokra
|
4 |
|
|
*/
|
5 |
|
|
"use strict";
|
6 |
|
|
|
7 |
|
|
class LoaderTargetPlugin {
|
8 |
|
|
constructor(target) {
|
9 |
|
|
this.target = target;
|
10 |
|
|
}
|
11 |
|
|
|
12 |
|
|
apply(compiler) {
|
13 |
|
|
compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => {
|
14 |
|
|
compilation.hooks.normalModuleLoader.tap(
|
15 |
|
|
"LoaderTargetPlugin",
|
16 |
|
|
loaderContext => {
|
17 |
|
|
loaderContext.target = this.target;
|
18 |
|
|
}
|
19 |
|
|
);
|
20 |
|
|
});
|
21 |
|
|
}
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
module.exports = LoaderTargetPlugin;
|