chore(build): remove use of q.denodeify

This change also makes webpack properly reject
promise on build errors

Closes #6546
This commit is contained in:
Pawel Kozlowski
2016-01-18 15:08:49 +01:00
committed by Misko Hevery
parent ebe14720eb
commit b2db6401cc
2 changed files with 36 additions and 6 deletions
+32
View File
@@ -0,0 +1,32 @@
var webpack = require('webpack');
/**
* Wraps the original `webpack` function to convert execution
* result to a promise and properly report errors.
*
* @param options
* @returns {Function}
*/
function webPackPromiseify(options) {
return new Promise(function (resolve, reject) {
webpack(options, function(err, stats) {
var jsonStats = stats.toJson() || {};
var statsErrors = jsonStats.errors || [];
if (err) {
return reject(err);
}
if (statsErrors.length) {
return reject(statsErrors);
}
return resolve(stats);
});
});
}
module.exports = webPackPromiseify;