Skip to content

Instantly share code, notes, and snippets.

@jprivillaso
Created December 10, 2017 20:36
Show Gist options
  • Save jprivillaso/6378f8fa00b0c15825c3e5c9311f7ce4 to your computer and use it in GitHub Desktop.
Save jprivillaso/6378f8fa00b0c15825c3e5c9311f7ce4 to your computer and use it in GitHub Desktop.
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