Adds stats presets support to the CLI

the CLI wasn't processing stats presets and was throwing
```sh
webpack/bin/webpack.js:63
	var outputOptions = Object.create(options.stats || firstOptions.stats || {});
	                           ^

TypeError: Object prototype may only be an Object or null
```

first PR here and couldn't find a contributor guide, so let
me know if you need me to fix/add something =)
This commit is contained in:
BuraBure 2016-04-18 23:06:36 -03:00
parent c7d71fba89
commit 79c5d18d5d
1 changed files with 5 additions and 0 deletions

View File

@ -135,6 +135,11 @@ function processOptions(options) {
var firstOptions = Array.isArray(options) ? options[0] : options; var firstOptions = Array.isArray(options) ? options[0] : options;
if(typeof options.stats === "boolean" || typeof options.stats === "string") {
var statsPresetToOptions = require("../lib/Stats.js").presetToOptions;
options.stats = statsPresetToOptions(options.stats);
}
var outputOptions = Object.create(options.stats || firstOptions.stats || {}); var outputOptions = Object.create(options.stats || firstOptions.stats || {});
if(typeof outputOptions.context === "undefined") if(typeof outputOptions.context === "undefined")
outputOptions.context = firstOptions.context; outputOptions.context = firstOptions.context;