您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AppendPlugin.js 733B

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