withastro/compiler

Astro misparses template following ternary

mb21 opened this issue · 1 comments

mb21 commented

What version of @astrojs/compiler are you using?

2.5.2

Note that I can reproduce in astro 4.3.2 but it worked still correctly in astro v4.2.1.

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

In the following astro template, <h2>Chats</h2> is just ignored:

---
import Layout from '../Layout.astro'
---
<Layout>
  {'foo' ? <p>A</p> : <p>B</p>}

  <h2>Chats</h2>
</Layout>

With Layout.astro containing just <slot />.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ewybuh-2am3fc?file=src%2Fpages%2Findex.astro

Thanks for taking the time to report this!
I can see that it's the same issue issue reported in #955. We're already tracking it there, so I'm going to close this as a duplicate. You can follow the workaround in the linked issue in the meantime.