AddBuildDependenciesPlugin.js 716 B

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