[AC-2363] require() does not properly handle circular dependencies
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2013-03-28T21:06:57.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | n/a |
| Reporter | Sven Herzberg |
| Assignee | Mauro Parra-Miranda |
| Created | 2013-03-28T16:15:18.000+0000 |
| Updated | 2016-03-08T07:41:23.000+0000 |
Description
This (quite simple) project will not work with Titanium (and according to the docs at http://wiki.commonjs.org/wiki/Modules/1.1.1#Require it should, see point 3 over there):
// app.js
var first = require('first');
// first.js
var first = {
name: 'first'
};
module.exports = first;
first.child = require('second');
// second.js
var second = {
name: 'second'
};
module.exports = second;
second.child = require('first');
Please fix this.
Sven, I'm sorry but I can't seem to find where it says that this code should work for titanium. This wiki is for commonjs. Point three in this document shows: math.js
increment.jsexports.add = function() { var sum = 0, i = 0, args = arguments, l = args.length; while (i < l) { sum += args[i++]; } return sum; };program.jsvar add = require('math').add; exports.increment = function(val) { return add(val, 1); };this code will not work for Titanium as there is no UI declarations. May you please clarify? Thank you, Cartervar inc = require('increment').increment; var a = 1; inc(a); // 2 module.id == "program";Invalid issue.