Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
petridw opened this issue Sep 8, 2023 · 2 comments · May be fixed by #12321
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler

Comments

@petridw
Copy link

petridw commented Sep 8, 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

@vidal7
Copy link

vidal7 commented Jan 23, 2025

Hello. Any news on that issue? I am migrating a large Vue 2 repo to Vue 3. I want to preserve the behavior of whitespace config of Vue 2 on Vue 3.

@edison1105 edison1105 added 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. and removed 🔩 p2-edge-case labels Feb 18, 2025
@vidal7
Copy link

vidal7 commented May 12, 2025

No news? It is still preventing us migrating our large repo to Vue 3 without having visual regressions. There is a active PR from November 2024 : #12321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler
Projects
None yet
3 participants