vue icon indicating copy to clipboard operation
vue copied to clipboard

due to my template syntax error, terminal stuck... loose control

Open chengfengfengwang opened this issue 1 year ago • 4 comments

Version

2.7.3

Reproduction link

github.com

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.

chengfengfengwang avatar Jul 06 '22 10:07 chengfengfengwang

Is it anyhow related to the system's low specs?

codeArtisanry avatar Jul 16 '22 16:07 codeArtisanry

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.

spiltcoffee avatar Jul 26 '22 03:07 spiltcoffee

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).

spiltcoffee avatar Jul 26 '22 03:07 spiltcoffee

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

sawmurai avatar Oct 15 '22 19:10 sawmurai