fix: loading sync remotes #86
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed same-origin detection for dev bundle paths: In dev, the bundlePaths in
asyncRequiremodule can stay as paths only e.g./src/mini.bundlemeaning they are split bundles of an mini app of the same origin. This PR fixes the erroneous behaviour where thosebundlePathswere marked as coming from different origin and we were skipping loading sync imported shared/remotes for them.Fixed bundle ID parsing for URL-based paths: In prod,
bundleIdwas being parsed incorrectly - whenoriginalBundlePathwas an URL, it would result in incorrectbundleIdwhich would skip loading sync shared & remotes. This PR fixes this by taking into account thatbundlePathcan be an URL when runninggetBundleIdFixed async initialization timing for early shared dependencies:
initializeSharingmight trigger loading other remotes, and for that we need to haveRCTNetworkingready so instead of awaitinginitializeSharingand loading__EARLY_SHARED__after, we only proceed withinitializeSharingsync part and then load the__EARLY_SHARED__immediately - after that's done we proceed to await completion ofinitializeSharingAdded production bundle path generation for exposed modules: When using MF bundle commands (
bundle-mf-hostorbundle-mf-remote), exposed modules now generate cleaner paths in the formatexposed/{exposeName}instead of the file system path, improving production bundle organization.Fixed race condition in remote loading: Added proper awaiting of the loading promise in
loadRemoteToRegistryto ensure remote modules are fully loaded before proceeding.Improved origin detection logic: Enhanced
isSameOriginfunction to properly handle cases where the bundle path is not a fully qualified URL (treating them as same origin), and better distinction between origin URL and public path for more accurate comparisons.