Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27251] iOS: require in native module assets fails

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 8.0.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterJan Vennemann
AssigneeUnknown
Created2019-07-18T03:14:57.000+0000
Updated2019-07-18T03:17:17.000+0000

Description

*Steps to reproduce the behavior*

Add the [appcelerator.syncserver.client](https://github.com/appcelerator-modules/appcelerator.syncserver.client) module to a project

Require the module in the app: const client = require('appcelerator.syncserver.client');

Build and run app

*Actual behavior* The following error is thrown:
Script Error {
    column = 20;
    line = 30;
    message = "Couldn't find module: jsdeferred for architecture: x86_64";
    sourceURL = "file:///Users/jvennemann/Library/Developer/CoreSimulator/Devices/4DDA0F33-7B7B-41FA-BF96-5800581D3BBB/data/Containers/Bundle/Application/C34F3D2A-9AB2-4394-B74F-D0D1BE3363F5/global-test-classic.app/appcelerator.syncserver.client";
    stack = "    at require@[native code]\n    at (/appcelerator.syncserver.client:30:20)\n    at global code(/appcelerator.syncserver.client:2251:70)\n    at require@[native code]\n    at (/app.js:443:21)\n    at global code(/app.js:449:70)\n    at require@[native code]\n    at (/ti.main.js:9576:10)\n    at loadAsync(/ti.main.js:9502:13)\n    at global code(/ti.main.js:9573:10)";
    toJSON = "<KrollCallback: 0x600002ad0900>";
}
*Expected behavior* The module loads without issues. *Notes* This is most likely related to incorrect handling in [tryNativeModule](https://github.com/appcelerator/titanium_mobile/blob/c465e92795ddaf8eb4ae44319df00e98bd4b3a10/iphone/TitaniumKit/TitaniumKit/Sources/API/KrollBridge.m#L1163). The module requires appcelerator.syncserver.client/jsdeferred.js, which will be split into module id and asset path. Only the asset path will be passed to ResolvedModule though, which causes [loadCoreModuleAsset](https://github.com/appcelerator/titanium_mobile/blob/c465e92795ddaf8eb4ae44319df00e98bd4b3a10/iphone/TitaniumKit/TitaniumKit/Sources/API/KrollBridge.m#L802) to throw.

Comments

No comments

JSON Source