Commit 8830b85d authored by Dan Abramov's avatar Dan Abramov
Browse files

Add compile progress indication

parent d8cf3147
Showing with 9 additions and 4 deletions
+9 -4
...@@ -57,14 +57,19 @@ function formatMessage(message) { ...@@ -57,14 +57,19 @@ function formatMessage(message) {
.replace('./~/css-loader!./~/postcss-loader!', ''); .replace('./~/css-loader!./~/postcss-loader!', '');
} }
var compiler = webpack(config, handleCompile); function clearConsole() {
compiler.plugin('done', function (stats) {
// Clear the console and reset the cursor
process.stdout.write('\x1B[2J\x1B[0f'); process.stdout.write('\x1B[2J\x1B[0f');
}
var compiler = webpack(config, handleCompile);
compiler.plugin('invalid', function () {
clearConsole();
console.log('Compiling...');
});
compiler.plugin('done', function (stats) {
clearConsole();
var hasErrors = stats.hasErrors(); var hasErrors = stats.hasErrors();
var hasWarnings = stats.hasWarnings(); var hasWarnings = stats.hasWarnings();
if (!hasErrors && !hasWarnings) { if (!hasErrors && !hasWarnings) {
console.log(chalk.green('Compiled successfully!')); console.log(chalk.green('Compiled successfully!'));
console.log(); console.log();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment