Skip to content

Commit 2713647

Browse files
committed
fix: clear console before ready log
1 parent 860dba6 commit 2713647

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/core/src/config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
defineConfig as defineRsbuildConfig,
1111
loadConfig as loadRsbuildConfig,
1212
mergeRsbuildConfig,
13+
logger as rsbuildLogger,
1314
rspack,
1415
} from '@rsbuild/core';
1516
import { glob } from 'tinyglobby';
@@ -81,6 +82,15 @@ import {
8182
} from './utils/syntax';
8283
import { loadTsconfig } from './utils/tsconfig';
8384

85+
rsbuildLogger.override({
86+
start: (message) => {
87+
// Soft clear, copied from https://github.com/lukeed/console-clear/blob/master/index.js.
88+
// "start" callback will only be called on watch mode (first compile not included).
89+
process.stdout.write('\x1B[H\x1B[2J');
90+
logger.start(message);
91+
},
92+
});
93+
8494
/**
8595
* This function helps you to autocomplete configuration types.
8696
* It accepts a Rslib config object, or a function that returns a config.

0 commit comments

Comments
 (0)