You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.1 KiB

4 years ago
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const { RawSource } = require("webpack-sources");
  7. const Module = require("./Module");
  8. /** @typedef {import("./util/createHash").Hash} Hash */
  9. class DllModule extends Module {
  10. constructor(context, dependencies, name, type) {
  11. super("javascript/dynamic", context);
  12. // Info from Factory
  13. this.dependencies = dependencies;
  14. this.name = name;
  15. this.type = type;
  16. }
  17. identifier() {
  18. return `dll ${this.name}`;
  19. }
  20. readableIdentifier() {
  21. return `dll ${this.name}`;
  22. }
  23. build(options, compilation, resolver, fs, callback) {
  24. this.built = true;
  25. this.buildMeta = {};
  26. this.buildInfo = {};
  27. return callback();
  28. }
  29. source() {
  30. return new RawSource("module.exports = __webpack_require__;");
  31. }
  32. needRebuild() {
  33. return false;
  34. }
  35. size() {
  36. return 12;
  37. }
  38. /**
  39. * @param {Hash} hash the hash used to track dependencies
  40. * @returns {void}
  41. */
  42. updateHash(hash) {
  43. hash.update("dll module");
  44. hash.update(this.name || "");
  45. super.updateHash(hash);
  46. }
  47. }
  48. module.exports = DllModule;