Skip to content

Commit 37ddf51

Browse files
committed
fix(log): 修复在windows上log频繁问题
1 parent 06ec7b3 commit 37ddf51

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

lib/plugins/progressBarPlugin.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ function ProgressBarPlugin() {
99
var stream = process.stderr;
1010

1111
return new webpack.ProgressPlugin(function (percent, msg) {
12-
if (stream) {
13-
stream.clearLine && stream.clearLine();
14-
stream.cursorTo && stream.cursorTo(0);
15-
if (msg && stream.write) {
16-
stream.write(colors.grey('[Bundler] ') + colors.green(msg));
17-
}
12+
if (stream && stream.write && msg) {
13+
stream.write(colors.grey('[Bundler] ') + colors.green(msg) + '\r');
1814
}
1915
});
2016
};

src/plugins/progressBarPlugin.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ function ProgressBarPlugin() {
77
var stream = process.stderr;
88

99
return new webpack.ProgressPlugin(function(percent, msg) {
10-
if(stream) {
11-
stream.clearLine && stream.clearLine();
12-
stream.cursorTo && stream.cursorTo(0);
13-
if(msg && stream.write) {
14-
stream.write(colors.grey('[Bundler] ') + colors.green(msg));
15-
}
10+
if(stream && stream.write && msg) {
11+
stream.write(colors.grey('[Bundler] ') + colors.green(msg) + '\r');
1612
}
1713
});
1814
};

0 commit comments

Comments
 (0)