@@ -473,6 +473,7 @@ - (void)start
473
473
// Load the source asynchronously, then store it for later execution.
474
474
dispatch_group_enter (prepareBridge);
475
475
__block NSData *sourceCode;
476
+ __block NSURL *sourceURL = self.bundleURL ;
476
477
477
478
#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include(<React/RCTDevLoadingViewProtocol.h>)
478
479
{
@@ -488,6 +489,9 @@ - (void)start
488
489
}
489
490
490
491
sourceCode = source.data ;
492
+ if (source.url ) {
493
+ sourceURL = source.url ;
494
+ }
491
495
dispatch_group_leave (prepareBridge);
492
496
}
493
497
onProgress: ^(RCTLoadingProgress *progressData) {
@@ -502,7 +506,7 @@ - (void)start
502
506
dispatch_group_notify (prepareBridge, dispatch_get_global_queue (QOS_CLASS_USER_INTERACTIVE , 0 ), ^{
503
507
RCTCxxBridge *strongSelf = weakSelf;
504
508
if (sourceCode && strongSelf.loading ) {
505
- [strongSelf executeSourceCode: sourceCode sync :NO ];
509
+ [strongSelf executeSourceCode: sourceCode withSourceURL: sourceURL sync :NO ];
506
510
}
507
511
});
508
512
RCT_PROFILE_END_EVENT (RCTProfileTagAlways, @" " );
@@ -1048,7 +1052,7 @@ - (void)registerModuleForFrameUpdates:(id<RCTBridgeModule>)module withModuleData
1048
1052
[_displayLink registerModuleForFrameUpdates: module withModuleData: moduleData];
1049
1053
}
1050
1054
1051
- - (void )executeSourceCode:(NSData *)sourceCode sync :(BOOL )sync
1055
+ - (void )executeSourceCode:(NSData *)sourceCode withSourceURL:( NSURL *)url sync :(BOOL )sync
1052
1056
{
1053
1057
// This will get called from whatever thread was actually executing JS.
1054
1058
dispatch_block_t completion = ^{
@@ -1073,12 +1077,13 @@ - (void)executeSourceCode:(NSData *)sourceCode sync:(BOOL)sync
1073
1077
};
1074
1078
1075
1079
if (sync ) {
1076
- [self executeApplicationScriptSync: sourceCode url: self .bundleURL ];
1080
+ [self executeApplicationScriptSync: sourceCode url: url ];
1077
1081
completion ();
1078
1082
} else {
1079
- [self enqueueApplicationScript: sourceCode url: self .bundleURL onComplete: completion];
1083
+ [self enqueueApplicationScript: sourceCode url: url onComplete: completion];
1080
1084
}
1081
1085
1086
+ // Use the original request URL here - HMRClient uses this to derive the /hot URL and entry point.
1082
1087
[self .devSettings setupHMRClientWithBundleURL: self .bundleURL];
1083
1088
}
1084
1089
0 commit comments