1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | "use strict";
|
7 |
|
8 | const makeSerializable = require("../util/makeSerializable");
|
9 | const ImportDependency = require("./ImportDependency");
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | class ImportWeakDependency extends ImportDependency {
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 | constructor(request, range, referencedExports) {
|
24 | super(request, range, referencedExports);
|
25 | this.weak = true;
|
26 | }
|
27 |
|
28 | get type() {
|
29 | return "import() weak";
|
30 | }
|
31 | }
|
32 |
|
33 | makeSerializable(
|
34 | ImportWeakDependency,
|
35 | "webpack/lib/dependencies/ImportWeakDependency"
|
36 | );
|
37 |
|
38 | ImportWeakDependency.Template = class ImportDependencyTemplate extends (
|
39 | ImportDependency.Template
|
40 | ) {
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | apply(
|
48 | dependency,
|
49 | source,
|
50 | { runtimeTemplate, module, moduleGraph, chunkGraph, runtimeRequirements }
|
51 | ) {
|
52 | const dep = (dependency);
|
53 | const content = runtimeTemplate.moduleNamespacePromise({
|
54 | chunkGraph,
|
55 | module: moduleGraph.getModule(dep),
|
56 | request: dep.request,
|
57 | strict: module.buildMeta.strictHarmonyModule,
|
58 | message: "import() weak",
|
59 | weak: true,
|
60 | runtimeRequirements
|
61 | });
|
62 |
|
63 | source.replace(dep.range[0], dep.range[1] - 1, content);
|
64 | }
|
65 | };
|
66 |
|
67 | module.exports = ImportWeakDependency;
|