-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Closed
Description
Version
3.0.0-rc.5
Reproduction link
https://codesandbox.io/s/wonderful-shirley-8g3zu?file=/src/index.js
Steps to reproduce
Once you open this codesandbox, the error will show up right away! This is happening because the source file is 1000 lines long and the line # formatter only works for files < 1000 lines.
What is expected?
This prints a codeframe.
What is actually happening?
It fails due to a bad range (RangeError Invalid count value
).
I ran into this bug when my vite
build was trying to print out some kind of warning but my compiled js
was > 10,000 lines long.The easiest solution would be to just add a Math.max
here to catch this edge case. To be more specific, change:
res.push(`${line}${' '.repeat(3 - String(line).length)}| ${lines[j]}`)
to:
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`)
Thanks for your help :)
Metadata
Metadata
Assignees
Labels
No labels