File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ function webpack(options, callback) {
1414 compiler = new MultiCompiler ( options . map ( function ( options ) {
1515 return webpack ( options ) ;
1616 } ) ) ;
17- } else {
17+ } else if ( typeof options === "object" ) {
1818 new WebpackOptionsDefaulter ( ) . process ( options ) ;
1919
2020 compiler = new Compiler ( ) ;
@@ -23,10 +23,14 @@ function webpack(options, callback) {
2323 new NodeEnvironmentPlugin ( ) . apply ( compiler ) ;
2424 compiler . applyPlugins ( "environment" ) ;
2525 compiler . applyPlugins ( "after-environment" ) ;
26+ } else {
27+ throw new Error ( "Invalid argument: options" ) ;
2628 }
2729 if ( callback ) {
28- if ( options . watch ) {
29- return compiler . watch ( options . watchDelay , callback ) ;
30+ if ( typeof callback !== "function" ) throw new Error ( "Invalid argument: callback" ) ;
31+ var watchOptions = options . watch || ! Array . isArray ( options ) ? options : options [ 0 ] ;
32+ if ( watchOptions . watch ) {
33+ return compiler . watch ( watchOptions . watchDelay , callback ) ;
3034 } else {
3135 compiler . run ( callback ) ;
3236 }
You can’t perform that action at this time.
0 commit comments