Skip to content

Commit

Permalink
fix(cli): sets stack trace limit
Browse files Browse the repository at this point in the history
modified the default stack trace limit and made cli to exit with exit code 1 when no args passed and webpack is not installed
  • Loading branch information
pranshuchittora committed May 30, 2019
1 parent 62e3c9e commit 869024f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/cli.js
Expand Up @@ -73,14 +73,16 @@ For more information, see https://webpack.js.org/api/cli/.`);
// When webpack is not installed and no args passed to the CLI
if (err.code === "MODULE_NOT_FOUND") {
let errorMessage =
"\n\u001b[31mwebpack not found, please install webpack using\n\t\u001b[33mnpm install --save-dev webpack\n";
"\n\u001b[31mwebpack not found, \u001b[33mplease install webpack using\n\t\u001b[32mnpm install --save-dev webpack\n";

if (process.env.npm_execpath !== undefined && process.env.npm_execpath.includes("yarn")) {
errorMessage =
"\n\u001b[31mwebpack not found, please install webpack using\n\t\u001b[33myarn add webpack --dev\n";
"\n\u001b[31mwebpack not found, \u001b[33mplease install webpack using\n\t\u001b[32myarn add webpack --dev\n";
}

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

Expand Down

0 comments on commit 869024f

Please sign in to comment.