Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ModulesInRootPlugin.js 689B

123456789101112131415161718192021222324
  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 ModulesInRootPlugin {
  7. constructor(source, path, target) {
  8. this.source = source;
  9. this.path = path;
  10. this.target = target;
  11. }
  12. apply(resolver) {
  13. const target = resolver.ensureHook(this.target);
  14. resolver.getHook(this.source).tapAsync("ModulesInRootPlugin", (request, resolveContext, callback) => {
  15. const obj = Object.assign({}, request, {
  16. path: this.path,
  17. request: "./" + request.request
  18. });
  19. resolver.doResolve(target, obj, "looking for modules in " + this.path, resolveContext, callback);
  20. });
  21. }
  22. };