[AC-5690] Apps forced to run in strict mode
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Won't Fix |
Resolution Date | 2018-04-05T15:11:17.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Studio, Titanium SDK & CLI |
Labels | n/a |
Reporter | Ian Taylor |
Assignee | Shak Hossain |
Created | 2018-04-03T15:19:30.000+0000 |
Updated | 2018-04-05T15:11:18.000+0000 |
Description
I've noticed that recent versions of the Titanium SDK force an iOS app to run in strict mode. Seems to be an issue since at least 6.3.0.GA. To reproduce: create an app including some code which is not permitted in strict mode, e.g. use "with()", package the app, error is thrown during packaging.
A bit more info: SDK 6.3.0 - app will build for simulator without error, but not for iTunes SDK 7.1.0 - app will not build for simulator or iTunes Have tried two machines running v8.9.1 and v4.6.0.
This is intended implicit behavior. In Titanium 7.1.0 and onwards, strict mode is required. We introduced Babel in node-titanium-sdk@0.2.0 to replace UglifyJS for parsing the code to find Titanium symbols. We also started using Babel to minify source. This shipped with Titanium SDK 6.1.0.GA on May 26, 2017. This means that since 6.1.0, all device and distribution builds would be minified and strict mode would be introduced. This explains why 6.3.0 works for simulator (i.e. no minify), but dist builds fail, as well as all 7.1.0 builds fail. We didn't start transpiling the code until node-titanium-sdk@0.4.7, which shipped with 7.1.0.GA on March 14, 2018. Transpilation is disabled by default and can be enabled in the tiapp.xml. Titanium does not have a flag to disable strict mode, nor do I think Babel would allow you to disable strict mode. However, you can disable minification by passing in the
\-\-skip\-js\-minify
flag to the build command or toggle the checkbox in Studio when building an app for distribution.