UNPKG

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