mirror of
https://github.com/alex8088/electron-vite.git
synced 2026-07-08 15:11:07 +08:00
fix(isolateEntries): handle non-TTY stdout in build reporter (#887)
The `clearLine` and `writeLine` helpers use TTY-only methods (`clearLine`, `cursorTo`, `moveCursor`) without checking `process.stdout.isTTY`, causing builds to crash in non-interactive environments like CI or piped output. See error I got in my CI environment: ``` vite v7.3.1 building ssr environment for production... ✗ Build failed in 7ms ✓ 0 modules transformed. ✗ Build failed in 9ms error during build: [vite:isolate-entries] Could not load virtual:isolate-entries: [vite:transform-reporter] process.stdout.clearLine is not a function ```
This commit is contained in:
parent
91368b6655
commit
5a8bbe3d0e
@ -170,6 +170,7 @@ function transformReporterPlugin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writeLine(output: string): void {
|
function writeLine(output: string): void {
|
||||||
|
if (!process.stdout.isTTY) return
|
||||||
clearLine()
|
clearLine()
|
||||||
if (output.length < process.stdout.columns) {
|
if (output.length < process.stdout.columns) {
|
||||||
process.stdout.write(output)
|
process.stdout.write(output)
|
||||||
@ -179,6 +180,7 @@ function writeLine(output: string): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearLine(move: number = 0): void {
|
function clearLine(move: number = 0): void {
|
||||||
|
if (!process.stdout.isTTY) return
|
||||||
if (move < 0) {
|
if (move < 0) {
|
||||||
process.stdout.moveCursor(0, move)
|
process.stdout.moveCursor(0, move)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user