@rhinostone/swig-core 2.5.2 → 2.6.0
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.
- package/lib/engine.js +8 -0
- package/package.json +1 -1
package/lib/engine.js
CHANGED
|
@@ -399,6 +399,14 @@ exports.install = function (self, frontend) {
|
|
|
399
399
|
parents = [];
|
|
400
400
|
tokens.tokens = [buildExtendsDeferred(tokens, options)];
|
|
401
401
|
} else {
|
|
402
|
+
if (tokens.parentExpr) {
|
|
403
|
+
// A dynamic {% extends %} path lowered to tokens.parentExpr can
|
|
404
|
+
// only resolve at render time. The sync precompile path walks the
|
|
405
|
+
// parent chain at compile time, before any runtime value exists,
|
|
406
|
+
// so a dynamic parent is unresolvable here — fail with a pointer
|
|
407
|
+
// to the async render path rather than a cryptic not-found.
|
|
408
|
+
throw new Error('Dynamic {% extends %} requires the async render path — use renderFile(path, locals, cb) with a loader that sets loader.async === true.');
|
|
409
|
+
}
|
|
402
410
|
parents = getParentsInternal(tokens, options);
|
|
403
411
|
if (parents.length) {
|
|
404
412
|
tokens.tokens = exports.remapBlocks(tokens.blocks, parents[0].tokens);
|