AddBuildDependenciesPlugin.js 738 B

1234567891011121314151617181920212223242526272829303132
  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. const PLUGIN_NAME = "AddBuildDependenciesPlugin";
  8. class AddBuildDependenciesPlugin {
  9. /**
  10. * @param {Iterable<string>} buildDependencies list of build dependencies
  11. */
  12. constructor(buildDependencies) {
  13. this.buildDependencies = new Set(buildDependencies);
  14. }
  15. /**
  16. * Apply the plugin
  17. * @param {Compiler} compiler the compiler instance
  18. * @returns {void}
  19. */
  20. apply(compiler) {
  21. compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
  22. compilation.buildDependencies.addAll(this.buildDependencies);
  23. });
  24. }
  25. }
  26. module.exports = AddBuildDependenciesPlugin;