esnunes / riotjs-loader

riotjs module loader for webpack
MIT License
103 stars 41 forks source link

Square Bracket Notation Issues #30

Open kevinroisin opened 8 years ago

kevinroisin commented 8 years ago

Not sure if I should open this here or on Riot itself. Perhaps I'm also just doing it wrong :)

Regardless, this code:

<my-tag>

  <td riot-tag="project-environment"
    someproperty={ testing.subObject['this-doesnt-work'].wontGetHere } />

  <script>

     this.testing = {
        'subObject': {
          'this-doesnt-work': {
            'wontGetHere': true
          }
        }
      }

  </script>
</my-tag>

gives this error in my Chrome console: VM8130:3 Uncaught (in promise) SyntaxError: Invalid or unexpected token

and it looks like it compiles to this:

(function(E
/**/) {
try{return ("testing"in this?this:window).testing.subObject[⁗0~].wontGetHere}catch(e){E(e,this)};
})

If I remove the square bracket notation by removing the hyphens and accessing the object directly, there is no issue. Thoughts? Thanks!