Created
December 10, 2017 20:36
-
-
Save jprivillaso/6378f8fa00b0c15825c3e5c9311f7ce4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compile = (configObject, webpackProcessName) => { | |
return new Promise((fulfill, reject) => { | |
webpack(configObject, (err, stats) => { | |
if (err) { | |
console.error(err.stack || err); | |
if (err.details) { | |
console.error(err.details); | |
} | |
reject(); | |
} | |
const info = stats.toJson(); | |
generateWebpackStats(info, webpackProcessName); | |
if (stats.hasErrors()) { | |
console.error(info.errors); | |
} | |
if (stats.hasWarnings()) { | |
console.warn(info.warnings); | |
} | |
console.log( | |
stats.toString({ | |
assets: true, | |
colors: true, | |
chunks: false, | |
errors: true, | |
timings: true, | |
version: true, | |
warnings: true | |
}) | |
); | |
fulfill(); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment