Skip to content

Commit

Permalink
refactor: move watching message to WebpackCLIPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
piecyk committed Oct 22, 2020
1 parent fd846e2 commit 793b444
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
7 changes: 7 additions & 0 deletions packages/webpack-cli/lib/plugins/WebpackCLIPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ class WebpackCLIPlugin {

logger.success(`Compilation${compilation.name ? `${compilation.name}` : ''} starting...`);
});

compiler.hooks.done.tap(PluginName, (compilation) => {
logger.success(`Compilation${compilation.name ? `${compilation.name}` : ''} finished`);

process.nextTick(() => {
if (compiler.watchMode) {
logger.success('watching files for updates...');
}
});
});
}
}
Expand Down
13 changes: 1 addition & 12 deletions packages/webpack-cli/lib/webpack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,10 @@ class WebpackCLI extends GroupHelper {
await this.processArgs(args, cliOptions);

let compiler;

let options = this.compilerConfiguration;
let outputOptions = this.outputConfiguration;

let isWatchMode;

if (Array.isArray(options)) {
isWatchMode = options.some((options) => options.watch);
} else {
isWatchMode = options.watch;
}

const isRawOutput = typeof outputOptions.json === 'undefined';

if (isRawOutput) {
Expand Down Expand Up @@ -327,10 +320,6 @@ class WebpackCLI extends GroupHelper {
} else {
logger.raw(`${stats.toString(foundStats)}`);
}

if (isWatchMode) {
logger.success('watching files for updates...');
}
};

compiler = this.createCompiler(options, callback);
Expand Down

0 comments on commit 793b444

Please sign in to comment.