{ "id": "163800", "key": "TIMOB-23997", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-12-05T18:04:46.000+0000", "created": "2016-10-07T06:18:43.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "cb-tooling" ], "versions": [], "issuelinks": [], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2017-07-19T15:21:27.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10207", "name": "Tooling" } ], "description": "Both the Android and iOS build have a bug when resolving the main JS file in a CommonJS Titanium module. Normally the JS files are named {{.js}}, but if this doesn't exist, it should:\r\n\r\n* See if there's a package.json\r\n* If there is, read it in and find a {{main}} property\r\n* Check that the file defined by {{main}} actually exists\r\n* If exists, use it\r\n* If not exists, look for an {{index.js}} file\r\n\r\nAs apart of TIMOB-23382 (PR https://github.com/appcelerator/titanium_mobile/pull/8004), the logic is bad. It will set the {{module.libFile}} to {{package.json}} or {{index.json}} which is technically incorrect. The good news is {{module.libFile}} for CommonJS modules is not used anywhere, however we should still fix it.", "attachment": [ { "id": "60488", "filename": "modules.zip", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-10-11T20:22:12.000+0000", "size": 14995, "mimeType": "application/zip" }, { "id": "60829", "filename": "timob23997BuildLog.rtf", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-05T19:50:53.000+0000", "size": 29438, "mimeType": "text/rtf" } ], "flagged": false, "summary": "iOS and Android revert incorrect CommonJS module changes", "creator": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "environment": null, "closedSprints": [ { "id": 751, "state": "closed", "name": "2016 Sprint 23 Tooling", "startDate": "2016-11-05T00:40:36.428Z", "endDate": "2016-11-19T01:40:00.000Z", "completeDate": "2016-11-28T03:51:25.291Z", "originBoardId": 199 } ], "comment": { "comments": [ { "id": "398620", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "TiSDK master PR: https://github.com/appcelerator/titanium_mobile/pull/8500\r\n\r\nTo test, add the following to your {{tiapp.xml}}:\r\n\r\n{code}\r\n\r\n\tfoo \r\n\tfoo-main \r\n\tfoo-main-noext \r\n\tfoo-main-rel \r\n\tfoo-main-rel-subdir \r\n\tfoo-index \r\n\tfoo-bad-nofile\r\n\r\n{code}\r\n\r\nThen unzip the attached {{modules.zip}} file into your project directory and build the app for both iOS and Android. You should see something like the following:\r\n\r\n{code}\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo/1.0.0\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo-bad-nofile/1.0.0\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo-index/1.0.0\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo-main/1.0.0\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo-main-noext/1.0.0\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo-main-rel/1.0.0\r\n[DEBUG] Detected commonjs module: com.appc.foo 1.0.0 @ /Users/chris/appc/workspace/testapp/modules/commonjs/foo-main-rel-subdir/1.0.0\r\n\r\n[DEBUG] Looking for Titanium module id=foo version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo/1.0.0\r\n[DEBUG] Looking for Titanium module id=foo-main version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo-main version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo-main/1.0.0\r\n[DEBUG] Looking for Titanium module id=foo-main-noext version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo-main-noext version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo-main-noext/1.0.0\r\n[DEBUG] Looking for Titanium module id=foo-main-rel version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo-main-rel version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo-main-rel/1.0.0\r\n[DEBUG] Looking for Titanium module id=foo-main-rel-subdir version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo-main-rel-subdir version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo-main-rel-subdir/1.0.0\r\n[DEBUG] Looking for Titanium module id=foo-index version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo-index version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo-index/1.0.0\r\n[DEBUG] Looking for Titanium module id=foo-bad-nofile version=latest platform=android,commonjs deploy-type=development\r\n[INFO] Found Titanium module id=foo-bad-nofile version=1.0.0 platform=commonjs deploy-type=development path=/Users/chris/appc/workspace/testapp/modules/commonjs/foo-bad-nofile/1.0.0\r\n[ERROR] Module \"foo-bad-nofile\" v1.0.0 is missing main file: foo-bad-nofile.js, package.json with \"main\" entry, or index.js\r\n{code}", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-10-11T20:21:59.000+0000", "updated": "2016-10-11T20:21:59.000+0000" }, { "id": "400342", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I reverted all changes to the build with respect to CommonJS modules in the Android and IOS build.\r\n\r\nTiSDK master PR: https://github.com/appcelerator/titanium_mobile/pull/8500\r\nTiSDK 6_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/8623", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-11-03T15:54:04.000+0000", "updated": "2016-11-17T20:57:42.000+0000" }, { "id": "402345", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "The PRs here have broken functionality for us to support commonJS modules that don't have a file named the exact same as the module id inside. ", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-12-01T15:30:35.000+0000", "updated": "2016-12-01T15:30:35.000+0000" }, { "id": "402422", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/8649\r\nhttps://github.com/appcelerator/titanium_mobile/pull/8648\r\n", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-12-01T18:39:12.000+0000", "updated": "2016-12-01T18:39:12.000+0000" }, { "id": "402581", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tested with this environment:\r\nNPM Version: 2.15.9\r\nNode Version: 4.5.0\r\nMac OS: 10.12.1\r\nAppc CLI: 6.0.0\r\nAppc CLI NPM: 4.2.8\r\nTitanium SDK version: 6.0.1.v20161202124626\r\nAppcelerator Studio, build: 4.8.0.201611121409\r\nXcode 8.1 GM\r\n\r\nI did get the messages that the modules were found. However, I also got this message for each module when I tried to build it on either Android or iOS device:\r\n{code}\r\n[DEBUG] Module foo requires Titanium SDK 6.1.0 or newer, but the selected SDK is 6.0.1\r\n[WARN] Could not find a valid Titanium module id=foo version=latest platform=ios,iphone,commonjs deploy-type=development\r\n{code}\r\n{code}\r\n[ERROR] Could not find all required Titanium Modules:\r\n[ERROR] id: foo\t version: latest\t platform: ios,iphone,commonjs\t deploy-type: development\r\n{code}\r\nThe log is attached.\r\n[^timob23997BuildLog.rtf]", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-05T19:48:42.000+0000", "updated": "2016-12-05T19:51:36.000+0000" }, { "id": "403088", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "NPM Version: 2.15.9\r\nNode Version: 4.5.0\r\nMac OS: 10.12.1\r\nAppc CLI: 6.0.0\r\nAppc CLI NPM: 4.2.8\r\nTitanium SDK version: 6.1.0.v20161205110006\r\nAppcelerator Studio, build: 4.8.0.201611121409\r\nXcode 8.1 GM\r\n\r\nFix is validated. Note that fix was validated using the attached zip, which has a min SDK 6.1.0", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-09T17:08:19.000+0000", "updated": "2016-12-09T17:08:19.000+0000" }, { "id": "424368", "author": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "body": "since the update to 6.1.0, the app freezes on startup on a real device (everything works fine on the simulator). The app is pre-alloy, so everything is in CommonJS.\r\n\r\nThe error I get:\r\n[ERROR] Application received error: undefined is not a constructor (evaluating 'new(void 0)') at downloader.js (line 1)\r\n[ERROR] Application received error: Module \"module/controllers/loginController.js\" failed to leave a valid exports object\r\n\r\nThe only thing I can think of, is that inside downloader.js there's this kind of code:\r\n---\r\nvar downloader = function() {\r\n\t\r\n\tvar myModule = require('com.myNativeModule');\r\n\t\r\n\tvar downloadUtility = require(\"/module/helpers/download_utility\");\r\n\r\n [.....]\r\n}\r\nmodule.exports = downloader;\r\n---", "updateAuthor": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-07-19T15:18:22.000+0000", "updated": "2017-07-19T15:18:22.000+0000" }, { "id": "424369", "author": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "body": "not sure if the error is related to this ticket, I went through all of the fixes/new features and this looked something that could interfere with CommonJS and modules. In case I will open a new ticket.", "updateAuthor": { "name": "a.marcone", "key": "a.marcone", "displayName": "Alberto Marcone", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-07-19T15:21:27.000+0000", "updated": "2017-07-19T15:21:27.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }