Skip to content

Commit 8698a12

Browse files
committed
fix: don't display vite | npm | pnpm syslem messages as spa errors
AdminForth/1778/newly-created-app
1 parent 5c05266 commit 8698a12

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

adminforth/modules/codeInjector.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,18 @@ class CodeInjector implements ICodeInjector {
12521252
}
12531253
});
12541254
devServer.stderr.on('data', (data) => {
1255+
const text = data.toString();
1256+
// pnpm/npm echo the script command they are about to run (e.g. "$ vite") to stderr,
1257+
// and emit empty lines. These are not errors, so don't log them as such.
1258+
const meaningful = stripAnsiCodes(text)
1259+
.split('\n')
1260+
.filter((line: string) => line.trim() && !line.trim().startsWith('$ '));
1261+
if (meaningful.length === 0) {
1262+
process.env.HEAVY_DEBUG && console.log(`[AdminForth SPA]:`, text);
1263+
return;
1264+
}
12551265
afLogger.error(`[AdminForth SPA ERROR]:`);
1256-
afLogger.error(data.toString());
1266+
afLogger.error(text);
12571267
});
12581268

12591269
}

0 commit comments

Comments
 (0)