diff --git a/scripts/build.js b/scripts/build.js index 94edff581619..f107d14342a7 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -74,27 +74,25 @@ function buildNodePackage(p) { process.stdout.write(`[ ${chalk.green('OK')} ]\n`); } -async function buildBrowserPackages(packages) { - for (const p of packages) { - const srcDir = path.resolve(p, SRC_DIR); - const pkgJsonPath = path.resolve(p, 'package.json'); - - const {browser} = require(pkgJsonPath); - if (browser) { - if (browser.indexOf(BUILD_ES5_DIR) !== 0) { - throw new Error( - `browser field for ${pkgJsonPath} should start with "${BUILD_ES5_DIR}"` - ); - } - process.stdout.write(fixedWidth(`${path.basename(p)}\n`)); - await browserBuild( - path.resolve(srcDir, 'index.js'), - path.resolve(p, browser) +function buildBrowserPackage(p) { + const srcDir = path.resolve(p, SRC_DIR); + const pkgJsonPath = path.resolve(p, 'package.json'); + + const {browser} = require(pkgJsonPath); + if (browser) { + if (browser.indexOf(BUILD_ES5_DIR) !== 0) { + throw new Error( + `browser field for ${pkgJsonPath} should start with "${BUILD_ES5_DIR}"` ); - process.stdout.write(`[ ${chalk.green('OK')} ]\n`); } + browserBuild( + path.resolve(srcDir, 'index.js'), + path.resolve(p, browser) + ).then(() => { + process.stdout.write(fixedWidth(`${path.basename(p)}\n`)); + process.stdout.write(`[ ${chalk.green('OK')} ]\n`); + }); } - process.stdout.write('\n'); } function buildFile(file, silent) { @@ -144,5 +142,5 @@ if (files.length) { process.stdout.write('\n'); process.stdout.write(chalk.bold.inverse('Building browser packages\n')); - buildBrowserPackages(packages); + packages.forEach(buildBrowserPackage); }