Infinite loop in vue-template-compiler
See original GitHub issueVersion
2.6.10
Reproduction link
https://github.com/oguimbal/vuebug
Steps to reproduce
git clone git@github.com:oguimbal/vuebug.git
npm i
npm start
Wait a couple of seconds, and your compilation process will be frozen.
If you attach a debugger to the node process, you will see the infinite loop in generateCodeFrame()
method of vue-template-compiler:
What is expected?
I would expect the compiler not to freeze
What is actually happening?
The compiler is freezing
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:15 (8 by maintainers)
Top Results From Across the Web
I get error in console when use "v-if" directive. Infinite loop
Whenever you assign a variable in Vue it will trigger a new render, and on the next render it is executing the same...
Read more >[Solved]-Where is the loop infinity?-Vue.js - appsloveworld
You're changing isWeekend as the component is rendered, therefore causing the component to rerender, I believe this is causing the infinite loop.
Read more >You may have an infinite update loop in a component render ...
A plugin, or my Vue version, or something else? I am going to try upgrading my Vue (currently 2.5.16) and start disabling things...
Read more >vue-template-compiler | Yarn - Package Manager
js. This package can be used to pre-compile Vue 2.0 templates into render functions to avoid runtime-compilation overhead and CSP restrictions. In most...
Read more >vue-ref - npm Package Health Analysis - Snyk
Explore Similar Packages. vue-template-compiler. 95 · vue ... you should not change any reactive data. Otherwise the render will enter an infinite loop....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well I have found the culprit 😂 https://github.com/vuejs/vue/blob/d2db6af1a55fdb4d65746fb67f7bfbced7d916f0/src/compiler/codeframe.js#L8
This line. There’re many warnings that do not provide the
end
position. For those warnings,end
is calculated bysource.length
. However, in the following for-loop,count
is incremented bylineLength + 1
, which is incorrect if the line ends with CRLF. Thus the infinite loop.Also, this only happens when the template does not have an indentation because otherwise Vue would have normalized the template source during de-indentation
I just reproduced this issue… The repository URL in OP is different from the one in the screenshot. The correct one is https://github.com/oguimbal/vuebug-simple After cloning this repo & change the line endings I can reproduce the frozen output bug.