Skip to content

Commit

Permalink
fix: improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Mar 4, 2021
1 parent 7398e0c commit c751e8f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/webpack-cli/lib/webpack-cli.js
Expand Up @@ -940,8 +940,15 @@ class WebpackCLI {
const command = findCommandByName(name);

if (!command) {
this.logger.error(`Can't find and load command '${name}'`);
this.logger.error("Run 'webpack --help' to see available commands and options");
const builtInCommandUsed = externalBuiltInCommandsInfo.find(
(command) => command.name.includes(name) || name === command.alias,
);
if (typeof builtInCommandUsed !== 'undefined') {
this.logger.error(`For using '${name}' command you need to install '${builtInCommandUsed[0].pkg}' package`);
} else {
this.logger.error(`Can't find and load command '${name}'`);
this.logger.error("Run 'webpack --help' to see available commands and options");
}
process.exit(2);
}

Expand Down

0 comments on commit c751e8f

Please sign in to comment.