Subscribe on changes!

vue-template-compiler: whitespace "preserve" option causes compiler error when using v-slot with v-if/v-else-if/v-else

avatar
Sep 8th 2023

Vue version

3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-hfaexh?file=src%2FApp.vue

Steps to reproduce

  1. Create a new Vue app using create-vue
  2. Add whitespace: "preserve" option to compilerOptions in vite.config.js
  3. Add a v-if/v-else block of template elements where each template uses v-slot directive For example:
<template #foo v-if="true">Foo slot content</template>
<template #foo v-else>Other content</template>
  1. Run npm run dev

What is expected?

No compiler error

What is actually happening?

Compiler error: "v-else/v-else-if has no adjacent v-if or v-else-if"

System Info

No response

Any additional comments?

No response