Description
The titanium SDK minification process is causing the following apps to error out when building to iOS
https://github.com/appcelerator/appc-university-app
[ERROR] Script Error {
[ERROR] column = 697;
[ERROR] line = 1;
[ERROR] message = "Can't find variable: populateSpotlightSearch";
[ERROR] sourceURL = "file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/9D8A7184-ABA4-47AE-BCBC-F3C4957D859D/University.app/alloy/controllers/index.js";
[ERROR] stack = "file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/9D8A7184-ABA4-47AE-BCBC-F3C4957D859D/University.app/alloy/controllers/index.js:1:697\nonload@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/9D8A7184-ABA4-47AE-BCBC-F3C4957D859D/University.app/appcelerator-university-service.js:1:1725";
[ERROR] }
https://github.com/appcelerator/movies
[ERROR] Script Error {
[ERROR] column = 1680;
[ERROR] line = 1;
[ERROR] message = "Can't find variable: cellImageOffset";
[ERROR] sourceURL = "file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/alloy/controllers/movies_list.js";
[ERROR] stack = "d@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/alloy/controllers/movies_list.js:1:1680\nfile:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/alloy/controllers/movies_list.js:1:1343\nloadJsonFile@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/data.js:1:326\nmovies_get_list@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/data.js:1:548\nb@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/alloy/controllers/movies_list.js:1:1204\na@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/75763034-2C6D-473F-96AA-9110B270C2B3/Movies.app/alloy/controllers/movies_list.js:1:790";
[ERROR] }
Steps to reproduce
Obtain either of the above apps
Build with ti build -p ios --deploy-type test
* Movies, click one of the images
* University app, just let the app load
Actual
Apps will error out
Expected
Apps should not error out
This is fixed by applying the same fix in ALOY-1565, but I believe that probably isnt the fix we want to take as we will no longer be minifying fully https://github.com/appcelerator/node-titanium-sdk/pull/7
Alloy PR: https://github.com/appcelerator/alloy/pull/827
FYI, bug fix for the appc-university-app https://github.com/appcelerator/appc-university-app/pull/11
[~cbarber] - I've tried the latest Alloy (1.10.3) w/ the RC build of 6.1.1 and we are still seeing an issue with how underscore.js is getting minified. It is causing an error when _.template is called. Is there a patch to Titanium as well as Alloy for this issue?
So, after this ticket's PR, Alloy no longer minifies. All minification is done in the TItanium SDK. The new minification process apparently shipped in 6.1.0.GA. Is there a chance you can whip up a small test case app and attach it to this ticket? That would really help.
I have also tried with the latest SDK: 6.2.0.v20170622105148 underscore.js is still corrupted by the minification process.
[~cbarber] - yes, I will create a test case and post it. I can also duplicate this by copying the underscore.js from the build folder and putting it in a node.js project and trying to use _.template as well.
[~cbarber] -- Here is a simple project that duplicates the issue: https://github.com/brentonhouse/appc-minify-issue Just build this to an iOS device (with LiveView NOT enabled) to test it. The error you get is: {noformat} [ERROR] Script Error { [ERROR] column = 13811; [ERROR] line = 2; [ERROR] message = "Invalid escape in identifier: '\\'"; [ERROR] source = "var __t,__p=\\'\\',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,\\'\\');};\\nwith(obj||{}){\n__p+='\\n\\n '+\n((__t=( content ))==null?'':__t)+\n'\\n\\n';\n}\nreturn __p;\n"; [ERROR] sourceURL = "file:///var/containers/Bundle/Application/8C2018E6-AE2B-417F-B684-A172A3263407/appc-minify-issue.app/alloy/underscore.js"; [ERROR] } {noformat}
[~brentonhouse] Awesome! Thank you. I'll get started asap.
I tested your app with local builds of the Titanium SDK 6_1_X (6.1.1) and master (6.2.0) branches using Titanium CLI 5.0.14, Alloy 1.10.3, Xcode 8.3.3 (iOS 10.3.1), and Node.js 8.1.2 and it worked both times:
It didn't seem to matter whether I used the JSCore framework or the built-in TiJSCore. I did NOT use Studio, LiveView, or the Appc CLI. Can you give me some more details about your environment?
I tried with: Titanium SDKs 6.1.0.GA & 6.1.1.RC & 6.2.X Alloy 1.9.x and 1.10.3 OS: Mac OS X 10.12.5 Node.js: 6.10.3 npm: 3.10.10 Titanium CLI: 5.0.14 No Studio or LiveView. Did use Appc CLI 6.2.2 -(but I will try with Ti CLI next)- Same result with Ti CLI 5.0.14 I did upload the generated underscore.js file from the build folder here: https://raw.githubusercontent.com/brentonhouse/appc-minify-issue/master/underscore.min.js You can try to compare it to the underscore.js file in your build folder to see if it is different. You are building to a physical device, correct?
For what it's worth, changing Titanium SDK to 6.0.4.GA (and no other changes) makes it work ok. Here is the minified underscore.js when using 6.0.4.GA: https://raw.githubusercontent.com/brentonhouse/appc-minify-issue/master/underscore.min_6.0.4.js
Oops, I was building for simulator. When I run
ti build -p ios --deploy-type test
, I can reproduce the error. Since I can reproduce the error in a Classic Titanium app, this is not an Alloy specific issue. I've reopened this ticket and moved it to TIMOB. Stay tuned.Thanks [~cbarber]!!
The problem is due to Babili double escaping single quotes. This logic is in
node-titanium-sdk
which has many out-of-date NPM dependencies. I updated the NPM deps and the error goes away. I will updatenode-titanium-sdk
's deps and get a new version published, then we can update TiSDK master and 6_1_X.node-titanium-sdk PR: https://github.com/appcelerator/node-titanium-sdk/pull/9
TiSDK master PR: https://github.com/appcelerator/titanium_mobile/pull/9176 TiSDK 6_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/9177 To test, create a classic Titanium app, drop
underscore.js
in the Resources directory, then add this to theapp.js
:Passed FR. Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.2 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.1.X locally built w/ pr/9177 Appcelerator Studio, build: 4.9.0.201705302345 Xcode 8.3.2 iOS Device 10 I tried the demo apps and there were no errors when launched. For the "movies" app I also pushed a button. No errors were seen, and a list of movies were shown. Closing ticket as changes were seen in 6.1.1.v20170626160851
Regression triggered by this ticket: TIMOB-25328