Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1651] Alloy > Uglify converts arguments[0] causing controller creation to fail.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2014-05-04T06:20:12.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy
Labelsn/a
ReporterAndrew Greenstreet
AssigneeRitu Agrawal
Created2014-03-24T01:25:25.000+0000
Updated2016-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

Comments

  1. Ritu Agrawal 2014-03-24

    [~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.
  2. Andrew Greenstreet 2014-03-24

    In this case, just using the CLI with: ti build --platform mobileweb --deploy-type production
  3. Ritu Agrawal 2014-03-31

    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.
  4. Ritu Agrawal 2014-05-04

    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.

JSON Source