Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6287] Android: V8/Rhino: CommonJS require() fails for absolute paths

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-11-23T16:06:44.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2011-47, Release 1.8.0.1
ComponentsAndroid
Labelsbranch-v8
ReporterBill Dawson
AssigneeBill Dawson
Created2011-11-22T17:10:11.000+0000
Updated2011-11-23T16:06:44.000+0000

Description

Fail/Test Case

Use this project structure.

Resources/app.js

Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'#000',
	exitOnClose: true
});

Ti.include("sub/sub.js");
win.add(Ti.UI.createLabel({
	top: "20dp", left: "20dp", right: "20dp", height: "40dp", color: "white",
	text: rootmod.sayHi("from a module in /.")
}));
win.open();

Resources/rootmod.js

exports.sayHi = function(s) {return "Hello, " + s ; };

Resources/sub/sub.js

var rootmod = require("/rootmod");
Run that app and it will tell you that the module can't be found. (Or, if you're testing the fix, it should put a label that says "Hello, from a module in /".)

Comments

  1. Bill Dawson 2011-11-22

    Marshall's huge TIMOB-6073 will likely fix this. Wait on it.
  2. Bill Dawson 2011-11-23

    Marshall's TIMOB-6073 will fix this.
  3. Bill Dawson 2011-11-23

    Oh, did I mention Marshall's TIMOB-6073 will fix this?
  4. Natalie Huynh 2011-11-23

    Tested with v8/rhino on Xoom: 3.2.1 LG Exp: 2.2.2 Droid 3: 2.3.4

JSON Source