File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,15 +70,19 @@ For more information, see https://webpack.js.org/api/cli/.`);
7070 try {
7171 options = require ( "./utils/convert-argv" ) ( argv ) ;
7272 } 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'" ) {
7575 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"
7777 ) ;
78- process . exitCode = 1 ;
78+
7979 return ;
8080 }
8181
82+ if ( err . name !== "ValidationError" ) {
83+ throw err ;
84+ }
85+
8286 const stack = ErrorHelpers . cleanUpWebpackOptions ( err . stack , err . message ) ;
8387 const message = err . message + "\n" + stack ;
8488
You can’t perform that action at this time.
0 commit comments