1 | /*
|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
3 | Author Tobias Koppers @sokra
|
4 | */
|
5 |
|
6 | ;
|
7 |
|
8 | /** @typedef {import("../Compiler")} Compiler */
|
9 |
|
10 | class AddBuildDependenciesPlugin {
|
11 | /**
|
12 | * @param {Iterable<string>} buildDependencies list of build dependencies
|
13 | */
|
14 | constructor(buildDependencies) {
|
15 | this.buildDependencies = new Set(buildDependencies);
|
16 | }
|
17 |
|
18 | /**
|
19 | * Apply the plugin
|
20 | * @param {Compiler} compiler the compiler instance
|
21 | * @returns {void}
|
22 | */
|
23 | apply(compiler) {
|
24 | compiler.hooks.compilation.tap(
|
25 | "AddBuildDependenciesPlugin",
|
26 | compilation => {
|
27 | compilation.buildDependencies.addAll(this.buildDependencies);
|
28 | }
|
29 | );
|
30 | }
|
31 | }
|
32 |
|
33 | module.exports = AddBuildDependenciesPlugin;
|