File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,19 @@ For more information, see https://webpack.js.org/api/cli/.`);
70
70
try {
71
71
options = require ( "./utils/convert-argv" ) ( argv ) ;
72
72
} catch ( err ) {
73
- if ( err . name !== "ValidationError" ) {
74
- console . error ( "\n\u001b[1m\u001b[31mWebpack not found, please install webpack" ) ;
73
+ // When webpack is not installed and no args passed to the CLI
74
+ if ( err . code === "MODULE_NOT_FOUND" && err . message === "Cannot find module ' webpack-sources'" ) {
75
75
console . error (
76
- "\u001b[1m \u001b[31mAlternatively, run 'webpack(-cli) --help' for usage info.\u001b[39m\ u001b[22m \n"
76
+ "\n \u001b[31mwebpack not found, please install webpack using\n\t\ u001b[33mnpm install --save-dev webpack \n"
77
77
) ;
78
- process . exitCode = 1 ;
78
+
79
79
return ;
80
80
}
81
81
82
+ if ( err . name !== "ValidationError" ) {
83
+ throw err ;
84
+ }
85
+
82
86
const stack = ErrorHelpers . cleanUpWebpackOptions ( err . stack , err . message ) ;
83
87
const message = err . message + "\n" + stack ;
84
88
You can’t perform that action at this time.
0 commit comments