@zohodesk/client_build_tool 0.0.12-exp.5 → 0.0.12-exp.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,6 +19,8 @@ class MurphyInjectorPlugin {
|
|
|
19
19
|
constructor(entries = [], options) {
|
|
20
20
|
this.entries = entries;
|
|
21
21
|
this.options = options;
|
|
22
|
+
this.jsTemplate = options.cdnMapping.jsTemplate || '{{__JS_CDN__}}';
|
|
23
|
+
this.cdnMapping = options.cdnMapping;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
apply(compiler) {
|
|
@@ -54,13 +56,18 @@ class MurphyInjectorPlugin {
|
|
|
54
56
|
const childChunks = childCompilation.chunks;
|
|
55
57
|
|
|
56
58
|
_htmlWebpackPlugin.default.getHooks(compilation).alterAssetTags.tapAsync(pluginName, (data, cb) => {
|
|
57
|
-
let fileName =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
let fileName = '';
|
|
60
|
+
const childFiles = childCompilation.entrypoints.get(name).getFiles();
|
|
61
|
+
|
|
62
|
+
if (childFiles.length !== 1) {
|
|
63
|
+
compilation.errors.push(new Error(`${pluginName}: Expected exactly 1 child file for entry "${name}", but got ${childFiles.length}.`));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.cdnMapping.isCdnEnabled) {
|
|
67
|
+
fileName = childFiles[0];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
;
|
|
64
71
|
data.assetTags.scripts.unshift({
|
|
65
72
|
tagName: "script",
|
|
66
73
|
voidTag: false,
|