R
R
Roman L.2016-01-11 22:10:18
webpack
Roman L., 2016-01-11 22:10:18

How to wait for WebPack to work?

Hey!
I need to wait for the build to finish and run the command, how can I do this? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vsuhachev, 2016-01-12
@vsuhachev

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')
  })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question