-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix multiple entries pointing to wrong bundle in dist #8991
Conversation
@@ -347,6 +347,10 @@ function getLoaderRuntime({ | |||
} | |||
|
|||
let externalBundles = bundleGraph.getBundlesInBundleGroup(bundleGroup); | |||
externalBundles = externalBundles.filter( | |||
externalBundle => externalBundle.target == bundle.target, | |||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question is how bundles from multiple different targets are getting into the same bundle groups in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I fixed it properly now 😅 @devongovett , added an updated graph pic as well where theres two separate bundlegroups for each target :)
Only issue here could be if targets don't have a name but I thought they would always have one? Is that true?
548e911
to
0c8782c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one 🍻 🚀
↪️ Pull Request
This aims to fix issue #8864 , Where specifying two dists, with an external shared bundle caused the wrong relative path to be placed in the loader code. I don't think this is an issue with the bundler algorithm though, since it still created separate shared bundles for each dist and the edges were fine. (see graph below)
Anyway, so it looks like the wrong path occurs when gettingexternalBundles
in the runtime code. It grabs both shared bundles (for each target) and then picked the first match by asset, which didn't take into account targets. Not sure if this fix is best, so do let me know.Update: I've added the target name when keying for bundlegroups, which actually addresses the problem of having two identical bundles (same entry asset) under the same bundlegroup.
💻 Examples
BEFORE:
AFTER:
🚨 Test instructions
Test case and @joeyslater 's reproduction
✔️ PR Todo