problem
If I define a commonjs module named *utils.js* or *Utils.js* in my iOS project, I get a runtime error when trying to access it. The error looks like the attached screenshot when used with the test case below. This issue does *not* occur on Android or Mobileweb. This error also does not occur if I move utils.js into a folder. I assume that iOS is overwriting utils.js within an internally used module of it own, or something to that effect.
expected behavior
I should be able to define and use a commonjs module named utils.js or Utils.js in my iOS project.
test case
utils.js
exports.sayHi = function() {
alert('hi');
}
app.js
require('utils').sayHi();
The titanium submodule utils is imported. The same goes for all .js files named as titanium submodules. More info here: http://developer.appcelerator.com/question/145896/ti-30-requireui-returns-the-tiui-module-instead-of-uijs
Yet another case: http://developer.appcelerator.com/question/147253/commonjs-module-not-working-in-ios-simulator
Issue does not reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
Is there any info on where this was actually resolved? A commit in 3.0.2 or something? I just confirmed that it is now working properly in 3.1.0 for me as well.
Issue does not reproduces Tested with iOS SDK: 5.1 iOS iPhone Simulator: 5.1 Mac OS X Version 10.7.5 Titanium SDK version 3.1.1.v20130606121419 Titanium Studio, build: 3.0.1.201212181159
Closing ticket as the issue cannot be reproduced and due to the above comments.