-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite loop in vue-template-compiler #10547
Comments
Hey, in order to check we need a boiled down repro without any extra dependency (like storybook). Ping me when you get a boiled down repro so I can get a look |
@posva No problem... https://github.com/oguimbal/vuebug-simple
Then hit F5 (if using vscode, otherwise nb: I know that i forgot to include pug loader ... but thats the point, it freezes without error. [edit] NB: The tight loop is in generateCodeFrame(), where line 16-17 seems fishy to me |
It shows an error instead of freezing:
The error comes from vue-loader though. It could maybe display a warning if the specified lang does not contain a rule in the webpack config but at the same time the need of using pre processors is explained on the very first paragraph |
Not on my machine oO' (see screenshot as "proof") However, if you look at this , it is kind of obvious that this loop can never finish in some circumstances. For me, with my repo, it gets called that way:
Which freezes: https://codesandbox.io/embed/xenodochial-roentgen-5dbbq |
@posva I know know if you dont believe me or if you dont have the time to look at it, but I think it is probably due to the fact that I'm on Windows and you might not: My line breaks are Thus generateCodeFrame() gets called with "16" as length in the example above (which should be 14 without The split But the line Anyway I wont bother you further with that, the problem is solved for me anyway :) |
I see, you should use LF ending. It can be enforced through eslint via |
Even when using CRLF endings in the bug.vue file (on osx), I get the same error as before, no infinite loop 🤔 |
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 |
So… I believe this is a bug. PR's welcome. |
Well I have found the culprit 😂 Line 8 in d2db6af
This line. Also, this only happens when the template does not have an indentation because otherwise Vue would have normalized the template source during de-indentation |
The fix is as simple as
|
Created a pull request that should fix it. Just a suggestion that is a bit more agnostic about wether if this funciton input has CR in source. Plus it breaks out of the loop if |
哈哈 |
xx |
Any updates on this ? |
Version
2.6.10
Reproduction link
https://github.com/oguimbal/vuebug
Steps to reproduce
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
The text was updated successfully, but these errors were encountered: