Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve error message #2482

Merged
merged 4 commits into from Mar 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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