From 8c0195ddf19798fe57f91a469433f69040a69706 Mon Sep 17 00:00:00 2001 From: Emil Persson Date: Fri, 7 Dec 2018 12:10:55 +0100 Subject: [PATCH] Attempt to fix #2340 --- packages/core/parcel-bundler/src/Bundle.js | 9 +++++++++ packages/core/parcel-bundler/src/Bundler.js | 2 ++ 2 files changed, 11 insertions(+) diff --git a/packages/core/parcel-bundler/src/Bundle.js b/packages/core/parcel-bundler/src/Bundle.js index e4dbf718776..3bd540f734b 100644 --- a/packages/core/parcel-bundler/src/Bundle.js +++ b/packages/core/parcel-bundler/src/Bundle.js @@ -89,6 +89,15 @@ class Bundle { return bundle; } + addChildBundle(bundle) { + this.childBundles.add(bundle); + } + + addSiblingBundle(bundle) { + this.addChildBundle(bundle); + this.siblingBundles.add(bundle); + } + get isEmpty() { return this.assets.size === 0; } diff --git a/packages/core/parcel-bundler/src/Bundler.js b/packages/core/parcel-bundler/src/Bundler.js index f82222bf88f..f94ccc28ca6 100644 --- a/packages/core/parcel-bundler/src/Bundler.js +++ b/packages/core/parcel-bundler/src/Bundler.js @@ -654,6 +654,7 @@ class Bundler extends EventEmitter { if ((dep && dep.dynamic) || !bundle.type) { // If the asset is already the entry asset of a bundle, don't create a duplicate. if (isEntryAsset) { + bundle.addChildBundle(asset.parentBundle); return; } @@ -665,6 +666,7 @@ class Bundler extends EventEmitter { ) { // If the asset is already the entry asset of a bundle, don't create a duplicate. if (isEntryAsset) { + bundle.addSiblingBundle(asset.parentBundle); return; }