Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

UseFilePlugin.js 798B

12345678910111213141516171819202122232425
  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 UseFilePlugin {
  7. constructor(source, filename, target) {
  8. this.source = source;
  9. this.filename = filename;
  10. this.target = target;
  11. }
  12. apply(resolver) {
  13. const target = resolver.ensureHook(this.target);
  14. resolver.getHook(this.source).tapAsync("UseFilePlugin", (request, resolveContext, callback) => {
  15. const filePath = resolver.join(request.path, this.filename);
  16. const obj = Object.assign({}, request, {
  17. path: filePath,
  18. relativePath: request.relativePath && resolver.join(request.relativePath, this.filename)
  19. });
  20. resolver.doResolve(target, obj, "using path: " + filePath, resolveContext, callback);
  21. });
  22. }
  23. };