Open jesusgn90 opened 2 years ago
+1 on this. found a similar issue in my codebase. had to rewrite the affected code to not use v-else/-if.
In the file vite.config.js
remove the whitespace: 'preserve'
it will be fine.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue({
template: {
compilerOptions: {
// whitespace: 'preserve'
}
}
})]
})
Vue version
3.2.37
Link to minimal reproduction
https://github.com/jesusgn90/issue-whitespace
Steps to reproduce
Run the project
See the console
What is expected?
No error is shown
What is actually happening?
Is showing an error that it should not, and is not compiling the template properly
this is valid code that should compile and it's not
System Info
Any additional comments?
I tested this with the
vue-cli
as well, so it's not related tovite
vsvue-cli
, the problem resides on@vue/compiler-core
potentially, and I suspect this is the problem:Since both
template
nodes are using the same slot name (#buttons
), it thinks they are thesame
node so when it reaches the second node (the one usingv-else-if
) there is no previous node using thev-if
because it just replaced the previous node.