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 = {};
require() does not support absolute paths and it never will. No implementation does except Ti, which was an oversight.