diff --git a/bin/packages/build-worker.js b/bin/packages/build-worker.js index f19045b795e073..7e3e636c013a1d 100644 --- a/bin/packages/build-worker.js +++ b/bin/packages/build-worker.js @@ -145,9 +145,15 @@ const BUILD_TASK_BY_EXTENSION = { module.exports = async ( file, callback ) => { const extension = path.extname( file ); const task = BUILD_TASK_BY_EXTENSION[ extension ]; - if ( task ) { - await task( file ); + + if ( ! task ) { + return; } - callback(); + try { + await task( file ); + callback(); + } catch ( error ) { + callback( error ); + } }; diff --git a/bin/packages/build.js b/bin/packages/build.js index e4e7c7355bf113..2f0d7fda9805ba 100755 --- a/bin/packages/build.js +++ b/bin/packages/build.js @@ -1,3 +1,5 @@ +/* eslint-disable no-console */ + /** * External dependencies */ @@ -65,9 +67,13 @@ let ended = false, complete = 0; stream - .on( 'data', ( file ) => worker( file, () => { + .on( 'data', ( file ) => worker( file, ( error ) => { onFileComplete(); + if ( error ) { + console.log( error ); + } + if ( ended && ++complete === files.length ) { workerFarm.end( worker ); }