mirror of https://github.com/webpack/webpack.git
Merge branch 'master' of https://github.com/webpack/webpack
This commit is contained in:
commit
9063c05dd5
|
|
@ -14,7 +14,7 @@ function webpack(options, callback) {
|
|||
compiler = new MultiCompiler(options.map(function(options) {
|
||||
return webpack(options);
|
||||
}));
|
||||
} else {
|
||||
} else if(typeof options === "object") {
|
||||
new WebpackOptionsDefaulter().process(options);
|
||||
|
||||
compiler = new Compiler();
|
||||
|
|
@ -23,10 +23,14 @@ function webpack(options, callback) {
|
|||
new NodeEnvironmentPlugin().apply(compiler);
|
||||
compiler.applyPlugins("environment");
|
||||
compiler.applyPlugins("after-environment");
|
||||
} else {
|
||||
throw new Error("Invalid argument: options");
|
||||
}
|
||||
if(callback) {
|
||||
if(options.watch) {
|
||||
return compiler.watch(options.watchDelay, callback);
|
||||
if(typeof callback !== "function") throw new Error("Invalid argument: callback");
|
||||
var watchOptions = options.watch || !Array.isArray(options) ? options : options[0];
|
||||
if(watchOptions.watch) {
|
||||
return compiler.watch(watchOptions.watchDelay, callback);
|
||||
} else {
|
||||
compiler.run(callback);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue