fix: avoid errors when files are removed during build (#2343)

Co-authored-by: Aaron <aaronklinker1@gmail.com>
This commit is contained in:
Thomas Howlett
2026-05-10 10:19:52 -06:00
committed by GitHub
parent 498f74b21b
commit 4f86143853
@@ -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),