diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index b7a990eb9..f391df7ca 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -10,6 +10,7 @@ import { defineConfig as defineRsbuildConfig, loadConfig as loadRsbuildConfig, mergeRsbuildConfig, + logger as rsbuildLogger, rspack, } from '@rsbuild/core'; import { glob } from 'tinyglobby'; @@ -81,6 +82,15 @@ import { } from './utils/syntax'; import { loadTsconfig } from './utils/tsconfig'; +rsbuildLogger.override({ + start: (message) => { + // Soft clear, copied from https://github.com/lukeed/console-clear/blob/master/index.js. + // "start" callback will only be called on watch mode (first compile not included). + process.stdout.write('\x1B[H\x1B[2J'); + logger.start(message); + }, +}); + /** * This function helps you to autocomplete configuration types. * It accepts a Rslib config object, or a function that returns a config.