privatenumber/vue-frag

Fragment not rendered in build mode

maelpetit opened this issue · 3 comments

Hi !

I'm trying to use nested v-frag in a table and everything is going fine in dev mode, but the subcomponents with v-frag are not rendered in build mode. Instead there is <!--function(a,b,e,n){return We(t,a,b,e,n,!0)}-->

I'm using nuxt-ts to run in dev and nuxt-ts build to build for prod

Here is a simplified version of my problem

page.vue

<template>
 <table>
   <MyComponent v-for="item in items" :key="item.id" :item="item" :level="0" />
 </table>
</template>
<script>
...
page.items = [
 { id: 0, name: '0', items: [ 
  { id: 1, name: '1', items: [] },
  { id: 2, name: '2', items: [] }
  ]
 },
 { id: 3, name: '3', items: [ 
  { id: 4, name: '4', items: [] },
  { id: 5, name: '5', items: [] }
  ]
 },
]
</script>

MyComponent.vue

<template>
 <div v-frag>
  <tr :level="level">{{ item.name }}</tr>
  <MyComponent v-for="subItem in item.items" :key="subItem.id" :item="subItem" :level="level + 1"/>
 </div>
</template>

expected output:

<table>
 <tr level="0">0</tr>
 <tr level="1">1</tr>
 <tr level="1">2</tr>
 <tr level="0">3</tr>
 <tr level="1">4</tr>
 <tr level="1">5</tr>
</table>

actual output:

<table>
 <tr level="0">0</tr>
 <!--function(a,b,e,n){return We(t,a,b,e,n,!0)}-->
 <tr level="0">3</tr>
 <!--function(a,b,e,n){return We(t,a,b,e,n,!0)}-->
</table>

Do you have any idea what might cause this ?

PS: Thanks for the great work

Thanks for your issue @maelpetit

I tried to reproduce your bug but it seems to be working here: https://jsfiddle.net/hirokiosame/h4pqb93e/

Which version are you using?

I can try looking into building this in production mode later this week if you're still having issues with it

I'm using version 1.1.2.

It maybe is linked to the fact that I am using typescript and nuxt

I'll try a few things and keep you up to date :)

Thanks for your time

I can't figure it out and I don't have the time...

I think I'll find another way to do it until 3.0 :)

Thanks again :)