Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(cli): error when no webpack and args found
trows an error when webpack is not installed and no args passed to the cli
  • Loading branch information
pranshuchittora committed Apr 26, 2019
1 parent 309cc1c commit 2250af0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/cli.js
Expand Up @@ -71,7 +71,12 @@ For more information, see https://webpack.js.org/api/cli/.`);
options = require("./utils/convert-argv")(argv);
} catch (err) {
if (err.name !== "ValidationError") {
throw err;
console.error("\n\u001b[1m\u001b[31mWebpack not found, please install webpack");
console.error(
"\u001b[1m\u001b[31mAlternatively, run 'webpack(-cli) --help' for usage info.\u001b[39m\u001b[22m\n"
);
process.exitCode = 1;
return;
}

const stack = ErrorHelpers.cleanUpWebpackOptions(err.stack, err.message);
Expand All @@ -93,7 +98,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
*/
const stdout = argv.silent
? {
write: () => {}
write: () => {}
} // eslint-disable-line
: process.stdout;

Expand Down

0 comments on commit 2250af0

Please sign in to comment.