BuilderIO / mitosis

Write components once, run everywhere. Compiles to React, Vue, Qwik, Solid, Angular, Svelte, and more.
https://mitosis.builder.io
MIT License
12.45k stars 552 forks source link

Sveltosis parsing a binding in a HTML property is broken #1063

Open michalvankodev opened 1 year ago

michalvankodev commented 1 year ago

I am interested in helping provide a fix!

Yes

Which generators are impacted?

Reproduction case

https://mitosis.builder.io/?outputTab=I4dwlg1kA%3D%3D%3D&inputTab=M4NwpgNgLmQ%3D&code=FAHgzgxgTglgDgFwAQBsCGA7A5gXgEQJh4B8wSSMAtnAPZTIDeSENGCApmwMLphhIBfJADMoNSkgDkAEhQwARgHowCAJ4p2YRWnowIG7bv3sAdBD6TQy6PASlQYAG7sUHAFwALdmgAmpciAIMAgaxAw%2BaAhoJkEh7AIgirGhVk4u7l6%2B9iAeAIxhEVExwRoJinnZOkHGzLxg%2BCxsnIyNHNx1AiRkSAwAAh4IlChIhdHyND6qAlZVeilAA%3D%3D%3D

Expected Behaviour

The class property should have been a concatenated string:

import { contentClass } from "$lib/styles/article/article.css";
// -------
<article class={"content" + contentClass} dangerouslySetInnerHTML={data.body}></article>

### Actual Behaviour

The `contentClass` variable just disappears and is not used at all.


### Additional Information

I've tested this type of binding with different properties and it is not working.
samijaber commented 1 year ago

cc @raymondmuller might have a better idea of where in the Sveltosis parser this lives.

dritter commented 1 year ago

Btw. here is a simpler reproduction. This is basically the same that @michalvankodev reported, but does not use imports.