adobe / htlengine

An HTL (Sightly) Interpreter/Compiler for Node.js
Apache License 2.0
47 stars 20 forks source link

multiple data-sly-use work in java (aem) and in 5.1.0 but fail in 6.3.1 #295

Closed jantimon closed 3 years ago

jantimon commented 3 years ago

I have a template which works in AEM (java) and worked with @adobe/htlengine 5.1.0:

<sly 
  data-sly-test=""
  data-sly-use.headline="./headline.htl"
>
  Hello world
</sly>

<sly 
  data-sly-test=""
  data-sly-use.headline="./headline.htl"
>
  Hello world
</sly>

In 5.1.0 it added the variable headline inside the if (from data-sly-test):

    const var_testVariable0 = "";
    if (var_testVariable0) {
      const headline = $.template('src/headline.htl');
      $.dom.text($n,"\n  Hello world\n");
    }

In 6.3.0 it adds the variable headline outside the if (from data-sly-test):

   const var_testVariable1 = "";
   const headline = $.template('src/headline.htl');
   if (var_testVariable1) {
       $.dom.text($n,"\n  Hello world\n");

So in 6.3.0 this will produce multiple headline variables in the same scope
Therefore node will throw the following exception:

Identifier 'headline' has already been declared (60:10)

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 6.3.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jantimon commented 3 years ago

Thanks for your fast support - the bug disappeared with 6.3.2! :)