From 4f861438535883f3fb42b3cd4b4670a561aed5bc Mon Sep 17 00:00:00 2001 From: Thomas Howlett <1786243+howlettt@users.noreply.github.com> Date: Sun, 10 May 2026 10:19:52 -0600 Subject: [PATCH] fix: avoid errors when files are removed during build (#2343) Co-authored-by: Aaron --- packages/wxt/src/core/utils/log/printFileList.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/wxt/src/core/utils/log/printFileList.ts b/packages/wxt/src/core/utils/log/printFileList.ts index ab25d67a..e0214228 100644 --- a/packages/wxt/src/core/utils/log/printFileList.ts +++ b/packages/wxt/src/core/utils/log/printFileList.ts @@ -4,6 +4,7 @@ import { filesize } from 'filesize'; import { printTable } from './printTable'; import { styleText } from 'node:util'; import { TextStyle } from '../../../utils/text-style'; +import { wxt } from '../../wxt'; export async function printFileList( log: (message: string) => void, @@ -21,9 +22,16 @@ export async function printFileList( ]; const prefix = i === files.length - 1 ? ' └─' : ' ├─'; const chunkColor = getChunkColor(file); - const stats = await lstat(file); - totalSize += stats.size; - const size = String(filesize(stats.size)); + + let size = ''; + try { + const stats = await lstat(file); + totalSize += stats.size; + size = String(filesize(stats.size)); + } catch (ex) { + wxt.logger.warn(`Could not get stats of '${file}' error: ${ex}`); + } + return [ `${styleText('gray', prefix)} ${styleText('dim', parts[0])}${styleText(chunkColor, parts[1])}`, styleText('dim', size),