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

RequireHeaderDependency.js 682B

1234567891011121314151617181920212223242526
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const NullDependency = require("./NullDependency");
  7. class RequireHeaderDependency extends NullDependency {
  8. constructor(range) {
  9. super();
  10. if (!Array.isArray(range)) throw new Error("range must be valid");
  11. this.range = range;
  12. }
  13. }
  14. RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate {
  15. apply(dep, source) {
  16. source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__");
  17. }
  18. applyAsTemplateArgument(name, dep, source) {
  19. source.replace(dep.range[0], dep.range[1] - 1, "require");
  20. }
  21. };
  22. module.exports = RequireHeaderDependency;