*Details:* If you have a CommonJS module in a "windows" folder, then you cannot require the CommonJS module.
*Notes:*
* This is not a regression from SDK 5.1.1.GA.
* This occurs with both Alloy and Titanium classic projects.
* To workaround this issue, do not use "windows" to store CommonJS modules.
*Steps to reproduce:*
Create an Alloy or Titanium class project
** If you created an Alloy project:
Download and unzip lib.zip
into the app
folder
In app/controllers/index.js
, replace the code with:
function doClick(e) {
alert($.label.text);
var monkey = require('windows/test').monkey;
Ti.API.info(monkey());
}
$.index.open();
** If you created a Titanium project:
Download and unzip windows.zip
into the Resources
folder
In app.js
, add the following code after creating label1
:
label1.addEventListener('click', function(evt) {
var monkey = require('/windows/test').monkey;
Ti.API.info(monkey());
});
Save your changes and install to iOS simulator or Android emulator
When the app launches, click on label that appears
*Actual:* On both iOS simulator and Android emulator, using either Alloy or Titanium projects, the CommonJS module cannot be found; see attachments.
*Expected:* On both iOS simulator and Android emulator, using either Alloy or Titanium projects, the CommonJS module should be found i.e. you should be able to use "windows" folder to store your CommonJS modules.
No comments