Skip to content

Commit 23eddcb

Browse files
committed
chore: improved err msg
1 parent a2062f2 commit 23eddcb

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

bin/cli.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,17 @@ For more information, see https://webpack.js.org/api/cli/.`);
7676
let errorMessage = "";
7777

7878
if (moduleName === "webpack") {
79-
errorMessage = `\n\u001b[31m${moduleName} not installed`;
80-
instructions = `Consider installing it using " npm install --save-dev ${moduleName} "\n`;
79+
errorMessage = `\n${moduleName} not installed`;
80+
instructions = `Install webpack to start bundling: \u001b[32m\n $ npm install --save-dev ${moduleName}\n`;
8181

8282
if (process.env.npm_execpath !== undefined && process.env.npm_execpath.includes("yarn")) {
83-
instructions = `Consider installing it using " yarn add ${moduleName} --dev "\n`;
83+
instructions = `Install webpack to start bundling: \u001b[32m\n $ yarn add ${moduleName} --dev\n`;
8484
}
85-
} else {
86-
errorMessage = `\n\u001b[31mModule ${moduleName} is not found but is imported in configuration`;
87-
instructions = `If ${moduleName} is a package, install it using a package manager\n`;
85+
Error.stackTraceLimit = 1;
86+
console.error(`${errorMessage}\n\n${instructions}`);
87+
process.exitCode = 1;
88+
return;
8889
}
89-
90-
console.error(`${errorMessage}\n\n\u001b[32mTIP: ${instructions}`);
91-
Error.stackTraceLimit = 1;
92-
process.exitCode = 1;
93-
return;
9490
}
9591

9692
if (err.name !== "ValidationError") {

0 commit comments

Comments
 (0)