From 164ba328c6e172297d71b9d3ef871005931cca71 Mon Sep 17 00:00:00 2001 From: Jiawei Cao Date: Sat, 23 Jun 2018 11:04:04 +0200 Subject: [PATCH] [FIX] Bundles should be built one after another the current implementation builds multiple bundles in parallel. If there's dependency between the bundles, it can't be resolved correctly. The bundles need to built with the same order as they are specified in the bundle definition. --- lib/types/library/LibraryBuilder.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/types/library/LibraryBuilder.js b/lib/types/library/LibraryBuilder.js index 6cb0c2d20..72e703fd9 100644 --- a/lib/types/library/LibraryBuilder.js +++ b/lib/types/library/LibraryBuilder.js @@ -83,17 +83,19 @@ class LibraryBuilder extends AbstractBuilder { const bundles = project.builder && project.builder.bundles; if (bundles) { this.addTask("generateBundle", () => { - return Promise.all(bundles.map((bundle) => { - return tasks.generateBundle({ - workspace: resourceCollections.workspace, - dependencies: resourceCollections.dependencies, - options: { - projectName: project.metadata.name, - bundleDefinition: bundle.bundleDefinition, - bundleOptions: bundle.bundleOptions - } + return bundles.reduce(function(sequence, bundle) { + return sequence.then(function() { + return tasks.generateBundle({ + workspace: resourceCollections.workspace, + dependencies: resourceCollections.dependencies, + options: { + projectName: project.metadata.name, + bundleDefinition: bundle.bundleDefinition, + bundleOptions: bundle.bundleOptions + } + }); }); - })); + }, Promise.resolve()); }); }