[AC-1651] Alloy > Uglify converts arguments[0] causing controller creation to fail.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Cannot Reproduce |
Resolution Date | 2014-05-04T06:20:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy |
Labels | n/a |
Reporter | Andrew Greenstreet |
Assignee | Ritu Agrawal |
Created | 2014-03-24T01:25:25.000+0000 |
Updated | 2016-03-08T07:38:08.000+0000 |
Description
When compiling a version of code with minified js, Uglify-js does not correctly handle the following statement in Alloy Controllers
var args = arguments[0] || {};
As "arguments" is not wrapped in any kind of function, uglify js interprets this as a variable, rather than a javascript type. This conversion, causes Alloy-based projects to fail.
The only workaround I've been able to figure out so far is:
var args = eval("arguments")[0] || {};
The original statement is per the documentation @
http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Controllers
[~andrew@gstreetmedia.com] Thanks for reporting this issue. Are you using Studio or CLI to compile your project? Please let us know the command you are using to compile the project and we would try to reproduce this issue in-house.
In this case, just using the CLI with: ti build --platform mobileweb --deploy-type production
Andrew - I am not able to reproduce this issue. I added the following code and the project compiles fine. var args = arguments[0] || {}; $.rowView.title = args.title || ''; $.rowView.url = args.url || ''; May be it would help if we have your project to reproduce the issue.
Resolving this ticket as we have not been able to reproduce this issue based on the information provided. We would be happy to reopen this ticket once we have more information available.