Vue 3 SFC Compiler function call with semicolon bug.
Vue version
3.2.47
Link to minimal reproduction
https://github.com/houd1ni/vue-issues
Steps to reproduce
- npm i
- npm run dev
- open in a browser (mine is ff latest).
- See the console.
At first glance, it is a sfc compiler stuff. If it is a vite's issue, I'd open it there and close here, though.
What is expected?
Clean console, Compo.vue output with its' hello.
What is actually happening?
It is crashing because the compiler removes semicolons and moves ;(window) after a function call.
System Info
ff111.0b3 @ win10x64 intel 12100 w 32GbDDR43200.
node v19.2.0
Any additional comments?
ðŸ˜
I think this is a @vue/compile-sfc
bug. I debugged it and found the problem。When processing defineProps, it deletes the semicolon of the next line together。 babel
think that the semicolon of the next line is the end of the statement
location
In this case, it cannot be parsed normally。
const props = defineProps({ prop: { type: String, required: true }, }), emits = defineEmits(['handleChange']), a = 1
playground