@plaudit/webpack-extensions 2.24.1 → 2.24.2

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.
@@ -171,7 +171,15 @@ class BlockJSONManagingPlugin {
171
171
  invalidTemplateLocation = "render_template";
172
172
  }
173
173
  delete json[invalidTemplateLocation];
174
- json[validTemplateLocation] = renderTemplate.length === 1 ? renderTemplate[0] : renderTemplate;
174
+ if (renderTemplate.length > 1) {
175
+ const error = new webpack_1.WebpackError("Encountered a block with multiple possible render files");
176
+ error.file = node_path_1.default.join(sourceDir, 'block.json');
177
+ compilation.warnings.push(error);
178
+ json[validTemplateLocation] = renderTemplate.find(p => p.endsWith(".php")) ?? renderTemplate[0];
179
+ }
180
+ else {
181
+ json[validTemplateLocation] = renderTemplate[0];
182
+ }
175
183
  }
176
184
  compilation.updateAsset(name, new webpack_1.sources.RawSource(JSON.stringify(json, undefined, " ")));
177
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaudit/webpack-extensions",
3
- "version": "2.24.1",
3
+ "version": "2.24.2",
4
4
  "scripts": {
5
5
  "prepublishOnly": "rm -rf build && mkdir build && tsc",
6
6
  "build": "tsc",