Skip to content
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

[TIMOB-24148] iOS: Add note for CommonJS modules colliding with Ti namespaces #8608

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions iphone/Classes/KrollBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,15 @@ - (TiModule *)loadCoreModule:(NSString *)path withContext:(KrollContext *)kroll
if (moduleClass == nil) {
return nil;
}

// If there is a core module that collides with the given path,
// throw an error log
NSURL *jsPath = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@.js", [[NSURL fileURLWithPath:[TiHost resourcePath] isDirectory:YES] path], path]];

if ([[NSFileManager defaultManager] fileExistsAtPath:[jsPath absoluteString]]) {
NSLog(@"[ERROR] The requested path '%@' collides with a native Ti%@um API or module.", path, @"tani");
NSLog(@"[ERROR] Please require the path with require('./%@') instead.", path);
}

// Ok, we have a native module, make sure instantiate and cache it
TiModule *module = [modules objectForKey:moduleID];
Expand Down