diff --git a/src/index.js b/src/index.js index a93edc0..968e288 100644 --- a/src/index.js +++ b/src/index.js @@ -99,6 +99,7 @@ export default async function microbundle(options) { } if (options.watch) { + const emitEvents = options.emit; return new Promise( (resolve, reject) => { process.stdout.write(chalk.blue(`Watching source, compiling to ${relative(cwd, dirname(options.output))}:\n`)); steps.map( options => { @@ -109,6 +110,9 @@ export default async function microbundle(options) { if (e.code==='ERROR' || e.code==='FATAL') { return reject(e); } + if (emitEvents) { + process.emit('event', e); + } if (e.code==='END') { getSizeInfo(options._code, options.outputOptions.file).then( text => { process.stdout.write(`Wrote ${text.trim()}\n`);