v-else on template element throws error
mcrampon opened this issue · 3 comments
mcrampon commented
Describe the bug
When using the v-else
directive on template
, I get an error:
<template>
<my-modal>
<template v-if="foo" #body>
Something if foo is truthy
</template>
<template v-else #body>
Something if foo is falsy
</template>
</my-modal>
</template>
✘ [ERROR] v-else/v-else-if has no adjacent v-if or v-else-if. [plugin vue]
components/my_component.vue:6:0:
6 │
╵ ^
Reproduction
esbuild@0.20.1 + unplugin-vue@5.0.3 + vue@3.4.19
System Info
System:
OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
Memory: 2.33 GB / 11.50 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v18.19.0/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
Browsers:
Chrome: 121.0.6167.184
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
sxzz commented
Cannot reproduce. Please provide a minimal reproduction to reopen the issue.
Thanks.
mcrampon commented
Here's a more detailed reproduction:
<!-- slotter.vue -->
<template>
<slot name="body" />
</template>
<!-- slotted.vue -->
<template>
<slotter>
<template v-if="true" #body>
Something
</template>
<template v-else #body>
Something else
</template>
</slotter>
</template>
<script>
import Slotter from './slotter.vue';
export default {
components: {
Slotter
}
};
</script>
✘ [ERROR] v-else/v-else-if has no adjacent v-if or v-else-if. [plugin vue]
components/slotted.vue:7:0:
7 │
╵ ^
sxzz commented
Still cannot reproduce. Please at least submit a reproduction repo (GitHub repo) that within the basic setup.
Plus, looks like the errors are not caused by unplugin-vue
itself, could be caused by Vue Compiler.