{ "id": "152628", "key": "AC-487", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2015-11-05T06:29:48.000+0000", "created": "2015-11-04T01:25:17.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2015-11-05T06:29:48.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "Ever since roughly version 1.5.1, Alloy has had problems with Common JS modules. It appears to be related to re-requiring in a library, as you might do if you require the module within a function. The app will throw a red-screen-o-death error that undefined has no such methods.\r\n\r\n{code}\r\nfunction doFoobar() {\r\n var foo = require('foolib');\r\n foo.bar();\r\n}\r\n\r\ndoFoobar(); // might work once\r\ndoFoobar(); // most most certainly it will throw the second time\r\n{code}\r\n\r\nI tried again with Alloy 1.7.23 today and got the same error. Using the exact same code, switching back to Alloy 1.5.1 and the app works without error.\r\n\r\n", "attachment": [], "flagged": false, "summary": "Alloy fails to properly include Common JS modules", "creator": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "subtasks": [], "reporter": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "environment": null, "comment": { "comments": [ { "id": "368964", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, This isn't a valid bug. I tried to reproduce this with alloy 1.6.2. The common JS module works. \r\n\r\nindex.js\r\n{code}\r\nfunction doClick(e) {\r\n var foo = require('common');\r\n var data = new foo(); \r\n }\r\n\r\n$.index.open();\r\n{code}\r\n\r\ncommon.js\r\n{code}\r\nfunction common() {\r\n return alert (\"You clicked the button\");\r\n};\r\nmodule.exports = common;\r\n{code}\r\n\r\nindex.xml\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nThanks.\r\n\r\n\r\n", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2015-11-04T10:23:01.000+0000", "updated": "2015-11-04T10:23:01.000+0000" }, { "id": "368999", "author": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "body": "I run into this bug frequently in actual applications. Yet I am unable to create a simple test case app that demonstrates it. I have two apps currently with which I have to use Alloy 1.5.1 because they fail if built with anything newer. As stated, simply downgrading to 1.5.1 \"fixes\" the issue. \r\n\r\nI suspect the minification / uglification process of Alloy is dropping a declaration that it thinks is a duplicate. Perhaps it happens only with sufficiently complex apps. ", "updateAuthor": { "name": "timpoulsen", "key": "timpoulsen", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/Havana" }, "created": "2015-11-04T18:40:57.000+0000", "updated": "2015-11-04T18:40:57.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }