TryNextPlugin.js 574 B

12345678910111213141516171819202122232425262728
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = class TryNextPlugin {
  7. constructor(source, message, target) {
  8. this.source = source;
  9. this.message = message;
  10. this.target = target;
  11. }
  12. apply(resolver) {
  13. const target = resolver.ensureHook(this.target);
  14. resolver
  15. .getHook(this.source)
  16. .tapAsync("TryNextPlugin", (request, resolveContext, callback) => {
  17. resolver.doResolve(
  18. target,
  19. request,
  20. this.message,
  21. resolveContext,
  22. callback
  23. );
  24. });
  25. }
  26. };