import webpack from 'webpack'
const webpackConfig = { ... }
const webpackCompile = config => new Promise((resolve, reject) => {
webpack(config, (err, stats) => err ? reject(err) : resolve(status))
});
webpackCompile(webpackConfig)
.then((status) => {
alert('OK')
})
.catch((err) => {
alert('ERR')
})