vue
vue copied to clipboard
due to my template syntax error, terminal stuck... loose control
Version
2.7.3
Reproduction link
Steps to reproduce
npm install npm run dev
What is expected?
server run normal, show syntax error in App.vue; not loose response
What is actually happening?
vue v-bind error cause terminal loose control, i have to kill it to restart. it is like a vue-loader error, but i am not sure.
Is it anyhow related to the system's low specs?
I'm getting the same issue occurring - a syntax error on v-slot usage is resulting in an apparent freeze.
Looking in Task Manager on Windows, the node.exe for my build is using up a whole core of my CPU, so it's not waiting on anything - instead, it looks like it might be stuck in a loop.
I attached a debugger, profiled, and found the build was spending a lot of time here: https://github.com/vuejs/vue-loader/blob/master/lib/loaders/templateLoader.js#L82
So, ran the build again with a breakpoint, and stepped into the function. It looks like it's getting into an infinite loop over these lines, when j
is larger than lines.length
:
https://github.com/vuejs/vue/blob/main/src/compiler/codeframe.ts#L14-L15
I'll see if I can get a small reproduction of the issue.
Alright, got a reproduction of the issue as well: https://github.com/spiltcoffee/vue-syntax-loop-example
Curiously, this particular error is only happening when using a separate file for the template source. If I stick the contents into a <template>
tag inside the .vue
file, it's "fine" (as in the build finishes and I see the expected error).
Thanks to @spiltcoffee's repo and analysis I created that PR with a fix. There is also a way older PR that fixes the bug in an older version of the codebase: https://github.com/vuejs/vue/issues/10547 ... well, and another one here: https://github.com/vuejs/vue/pull/12338