-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix(build): make output warning message clearer #12924
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Related and (maybe fixes) #11207 I don't know the implication but maybe we should clear the line too before calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
This could be a bit risky. Sometimes logs appear during transformation, and the logs could give a hint as to which file causes the log (though with an uglier output). This PR would clear the "current transforming file" and loses the information. |
Actually this is the opposite because we throttle the displayed file: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/reporter.ts#L63 |
Interesting. I'm not sure why it's being throttled, but I definitely had experienced the file name showed to be accurate that helped me in debugging things. |
Printing to terminal can be slow, famous bug report: npm/npm#11283 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it to the 4.4 milestone, I think we could merge this one in the next beta to get some folks trying it out.
I think it would still be good to make this work generically instead of only for I'd also prefer if we don't clear the current line (even if it could be wrong) since it could be helpful at times. Perhaps during the |
I'm in for monkey patching the console.log or process.write but this can have unexpected interactions with people building on top of it. How does Astro and Nuxt use (or not) the builtin Vite reporter? The fact that we could log the current transforming file before the log is a big win for me (but does that even possible? Rollup doesn't do parallel execution?) |
@bluwy @ArnaudBarre should we move this PR to the Vite 5 milestone? |
Completely changed my mind: I think we should go with monkey patching directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, I think it's also fine to merge this PR as a stop gap, and work on a more complete solution later.
packages/vite/src/node/build.ts
Outdated
readLine.clearLine(process.stdout, 0) | ||
readLine.cursorTo(process.stdout, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can simplify this like
vite/packages/vite/src/node/plugins/reporter.ts
Lines 280 to 283 in 1e299cc
function clearLine() { | |
process.stdout.clearLine(0) | |
process.stdout.cursorTo(0) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Description
before
after
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).