Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9123] Mobileweb: require() with absolute path fails

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-05-14T09:49:28.000+0000
Affected Version/sRelease 2.1.0, Release 2.0.1
Fix Version/sn/a
ComponentsMobileWeb
Labelsmobileweb, parity
ReporterTony Lukasavage
AssigneeChris Barber
Created2012-05-14T06:32:31.000+0000
Updated2014-01-28T23:57:34.000+0000

Description

Problem

Whenever an absolute path is used for a require in mobileweb, I get the red screen of death indicating that the module cannot be found.

Expected Behavior

Like with Android and iOS, when an absolute path is given for a require(), the call should be made relative to the Resources directory.

Test Case

The following test case work fine in Android and iOS, gives a red screen in mobileweb

app.js

require('/test/test');
var win = Ti.UI.createWindow({
    backgroundColor: '#fff',
    fullscreen: false,
    exitOnClose: true
});
win.open();

test/test.js

module.exports = {};

Comments

  1. Chris Barber 2012-05-14

    require() does not support absolute paths and it never will. No implementation does except Ti, which was an oversight.

JSON Source