Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(build): make output warning message clearer #12924

Merged
merged 5 commits into from
Jun 8, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'node:fs'
import path from 'node:path'
import readLine from 'node:readline'
import colors from 'picocolors'
import type {
ExternalOption,
Expand Down Expand Up @@ -910,6 +911,8 @@ export function onRollupWarning(
warn(warning)
}

readLine.clearLine(process.stdout, 0)
readLine.cursorTo(process.stdout, 0)
Copy link
Member

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

function clearLine() {
process.stdout.clearLine(0)
process.stdout.cursorTo(0)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

const userOnWarn = config.build.rollupOptions?.onwarn
if (userOnWarn) {
userOnWarn(warning, viteWarn)
Expand Down