From 869024fa60bc21150104b3a33ba4e3e0886be433 Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Thu, 30 May 2019 22:25:10 +0530 Subject: [PATCH] fix(cli): sets stack trace limit modified the default stack trace limit and made cli to exit with exit code 1 when no args passed and webpack is not installed --- bin/cli.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index 74a932783b5..ea72c7700e3 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -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; }