I'm working with Atom and Titanium SDK 6.0.1.GA, Alloy 1.9.8 and targeting Android API 22, I created a CommonJS module in the Resources folder but when I try to run my app I get the following error:
In ti:/module.js:303,2
Message: Uncaught Error: Requested module not found: contactClient
Source: throw new Error("Requested module not found: " + request);
V8Exception: Exception occurred at ti:/module.js:303: Uncaught Error: Requested module not found: contactClient
The code inside the module is this:
function getClient(path, successCallback, errorCallback){
var client = Ti.Network.createHTTPClient({
onload : successCallback,
onerror : errorCallback
});
client.open('GET', 'http://10.0.12.138:8284/' + path);
client.send();
}
function getContacts(successCallback, errorCallback){
getClient('contacts', successCallback, errorCallback);
}
exports.getContacts = getContacts;
The path to my module is Resources/contactClient.js and I try to load it in my index.js like this:
var contactsClient = require('contactClient');
I checked the documentation for CommonJS modules and according to it this shouldn't be a problem.
Am I doing something wrong? I'm placing the js file inside the Resources folder, is it another path?