Skip to content

Commit

Permalink
Merge pull request #862 from pranshuchittora/cli-blank-fix
Browse files Browse the repository at this point in the history
fix(cli): throws err when no args passed
  • Loading branch information
evenstensberg authored Jun 1, 2019
2 parents ce8f6e1 + 9f1deb2 commit 6ee3c0b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ For more information, see https://webpack.js.org/api/cli/.`);
try {
options = require("./utils/convert-argv")(argv);
} catch (err) {
if (err.code === "MODULE_NOT_FOUND") {
let errorMessage =
"\n\u001b[31mwebpack not installed, consider installing it using \n\u001b[32mnpm install --save-dev webpack\n";

if (process.env.npm_execpath !== undefined && process.env.npm_execpath.includes("yarn")) {
errorMessage =
"\n\u001b[31mwebpack not installed, consider installing it using \n\u001b[32myarn add webpack --dev\n";
}

console.error(errorMessage);
Error.stackTraceLimit = 1;
process.exitCode = 1;
return;
}

if (err.name !== "ValidationError") {
throw err;
}
Expand Down

0 comments on commit 6ee3c0b

Please sign in to comment.