Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20088] If you have a CommonJS module in a "windows" folder, then you cannot require the CommonJS module

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 5.1.2, Release 5.1.1
Fix Version/sn/a
ComponentsAndroid, iOS
Labelsqe-5.1.2
ReporterWilson Luu
AssigneeUnknown
Created2015-12-03T00:32:16.000+0000
Updated2018-02-28T19:55:45.000+0000

Description

*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.

Attachments

FileDateSize
android_emulator.png2015-12-03T00:32:08.000+000073760
ios_simulator.png2015-12-03T00:32:08.000+000028962
lib.zip2015-12-03T00:20:40.000+0000471
windows.zip2015-12-03T00:21:09.000+0000343

Comments

No comments

JSON Source