@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
- childChunks.forEach(chunk => {
59
- fileName = compilation.getPath((0, _nameTemplates.nameTemplates)("js", this.options), {
60
- chunk,
61
- contentHashType: "javascript"
62
- }); // ✅ Use Webpack's getPath to resolve your template properly
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/client_build_tool",
3
- "version": "0.0.12-exp.5",
3
+ "version": "0.0.12-exp.7",
4
4
  "description": "A CLI tool to build web applications and client libraries",
5
5
  "main": "lib/index.js",
6
6
  "bin": {