Matrix Version: v6.91.0
Two level SSJS is probably not accurate, so bear with me as I explain what I am trying to do.
We use Handlebars in our Matrix site which is include in every page via as part of the design assets. In one of our design customisation, we have something like:
<!-- Handlebars JS (local copy) -->
<script src="./?a=xxx" runat="server"></script>
<!-- Handlebars Helpers JS (part of git bride asset) -->
<script src="./?a=yyy:/js/handlebars.helpers.js" runat="server"></script>
This will enable us to use Handlebars in SSJS on every page.
I am building a standard component (as opposed to component services), in which Paint Layout I have the following:
<!-- I don't need to use Handlebars here, but I know it is available -->
<script runat="server">
...
print("%globals_asset_contents_raw:vvv%");
...
</script>
Asset vvv is an assets listing. In which Type Formats I have the following:
<script runat="server">
let template = `<h2>{{ title }}</h2>`;
let data = { 'title': 'Hello world' };
print(Handlebars.compile(template)(data));
</script>
In this assets listing asset, I found that Handlebars object is not available. And if I include it again as the above copy, my component works.
Is this an expected behaviour?
In addition to that, in the error log I notice that an entry (type of User warning) that says
(/core/include/general.inc:1336) - Unable to find an Asset for the URL "https://example.com/__data/assets/git_bridge/nnn/yyy/js/handlebars.helpers.js" [SYS0245]
which I am sure is related.
I would appreciate any feedback, opinion or insight into this. Thank you in advance.