Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
747 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | Author Tobias Koppers @sokra
|
---|
4 | */
|
---|
5 |
|
---|
6 | "use strict";
|
---|
7 |
|
---|
8 | const NormalModule = require("./NormalModule");
|
---|
9 |
|
---|
10 | /** @typedef {import("./Compiler")} Compiler */
|
---|
11 |
|
---|
12 | class LoaderTargetPlugin {
|
---|
13 | /**
|
---|
14 | * @param {string} target the target
|
---|
15 | */
|
---|
16 | constructor(target) {
|
---|
17 | this.target = target;
|
---|
18 | }
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Apply the plugin
|
---|
22 | * @param {Compiler} compiler the compiler instance
|
---|
23 | * @returns {void}
|
---|
24 | */
|
---|
25 | apply(compiler) {
|
---|
26 | compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => {
|
---|
27 | NormalModule.getCompilationHooks(compilation).loader.tap(
|
---|
28 | "LoaderTargetPlugin",
|
---|
29 | loaderContext => {
|
---|
30 | loaderContext.target = this.target;
|
---|
31 | }
|
---|
32 | );
|
---|
33 | });
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 | module.exports = LoaderTargetPlugin;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.