Skip to content

Commit

Permalink
fix(dev): don't exit on build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Nov 12, 2018
1 parent 058b5e7 commit 55213cd
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions packages/@moonreach/nodepack/src/commands/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@ module.exports = (api, options) => {
/** @type {execa.ExecaChildProcess} */
let child

return new Promise((resolve, reject) => {
const compiler = webpack(webpackConfig)
compiler.watch(
webpackConfig.watchOptions,
(err, stats) => {
if (err) {
error(err)
} else {
if (stats.hasErrors()) {
return reject(`Build failed with errors.`)
}
const compiler = webpack(webpackConfig)
compiler.watch(
webpackConfig.watchOptions,
(err, stats) => {
if (err) {
error(err)
} else {
if (child) {
child.kill()
}

if (stats.hasErrors()) {
error(`Build failed with errors.`)
} else {
if (child) {
child.kill()
info(chalk.blue('App restarting...'))
} else {
info(chalk.blue('App starting...'))
Expand All @@ -60,7 +61,7 @@ module.exports = (api, options) => {
})
}
}
)
})
}
)
})
}

0 comments on commit 55213cd

Please sign in to comment.