From 185c6a458fa7745d63f54cd8d8ce6fce92b52266 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Wed, 22 Mar 2017 08:30:50 +0100 Subject: [PATCH] fix app starting before the bundle has been written --- index.js | 2 +- lib/browserify.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c7427e08..4755088c 100644 --- a/index.js +++ b/index.js @@ -76,7 +76,7 @@ app.on('ready', () => { if (env.NODE_ENV !== 'production') { const browserify = require('./lib/browserify') const b = browserify({ watch: true }) - b.once('bundle', onReady) + b.once('written', onReady) } else { onReady() } diff --git a/lib/browserify.js b/lib/browserify.js index 5b9dae4b..d6666407 100644 --- a/lib/browserify.js +++ b/lib/browserify.js @@ -52,6 +52,7 @@ module.exports = opts => { b.bundle().pipe(concat(js => { fs.writeFile(`${__dirname}/../bundle.js`, js, err => { if (err) throw err + b.emit('written') process.stderr.write('ok!\n') }) }))