From 5a8bbe3d0e2b860307e2eff684fa9329cd9666f2 Mon Sep 17 00:00:00 2001 From: Michal Fudala Date: Mon, 16 Feb 2026 15:25:35 +0100 Subject: [PATCH] fix(isolateEntries): handle non-TTY stdout in build reporter (#887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ``` --- src/plugins/isolateEntries.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/isolateEntries.ts b/src/plugins/isolateEntries.ts index 5da43e9..e812286 100644 --- a/src/plugins/isolateEntries.ts +++ b/src/plugins/isolateEntries.ts @@ -170,6 +170,7 @@ function transformReporterPlugin( } function writeLine(output: string): void { + if (!process.stdout.isTTY) return clearLine() if (output.length < process.stdout.columns) { process.stdout.write(output) @@ -179,6 +180,7 @@ function writeLine(output: string): void { } function clearLine(move: number = 0): void { + if (!process.stdout.isTTY) return if (move < 0) { process.stdout.moveCursor(0, move) }