Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1565] KitchenSink v2 errors out on iOS

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2017-05-25T20:59:00.000+0000
Affected Version/sAlloy 1.10.0
Fix Version/sAlloy 1.10.1, CLI Release 6.3.0
Componentsn/a
Labelsn/a
ReporterEwan Harris
AssigneeChristopher Williams
Created2017-05-25T18:07:00.000+0000
Updated2017-10-10T17:41:17.000+0000

Description

Description

*I consider this a blocker as we will possibly be breaking applications in a minor version, and this also leads to uncertainties as to whether there are anymore issues like this* When building kitchensink-v2 for iOS with the latest Alloy, the app will error out when launching. With the below error *Notes* * The error only occurs when using TiCore, using JSCore the error is not seen. It seems the older TiCore will choke on the code, Android seems to be fine, Windows is currently untested * The error appears to be caused by the move to babylon/babili * The code that errors is
var res = { milliseconds: 0, months: 0, months: other.month() - base.month() + 12 * (other.year() - base.year())
        };
[ERROR] Script Error {
[ERROR]     line = 2058;
[ERROR]     message = "Attempted to redefine property 'months'.";
[ERROR]     sourceURL = "file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/alloy/moment.js";
[ERROR]     stack = "require@[native code]\nfile:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/log.js:3:21\nglobal code@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/log.js:24:70\nrequire@[native code]\nController@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/alloy/controllers/controls/index.js:45:19\ncreateController@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/alloy.js:306:52\nController@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/alloy/controllers/index.js:31:67\ncreateController@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/alloy.js:306:52\nglobal code@file:///Users/eharris/Library/Developer/CoreSimulator/Devices/DAE930F3-D384-42DE-B14D-F2EB6DDFE798/data/Containers/Bundle/Application/8EB66036-ABCE-4A04-B5B7-8BF05FDBBECC/KitchenSink.app/app.js:7:23";
[ERROR] }
[ERROR] Script Error Module "alloy/moment.js" failed to leave a valid exports object
[ERROR] Script Error Module "log.js" failed to leave a valid exports object
[DEBUG] Application booted in 891.723990 ms
[ERROR] ErrorController is up. ABORTING showing of modal controller
[ERROR] ErrorController is up. ABORTING showing of modal controller

Steps to reproduce

Install titanium and alloy npm i alloy -g && npm i titanium -g

Get kitchensink v2, from https://github.com/appcelerator/kitchensink-v2

Build the project using ti build -p ios

Actual

The app will error out

Expected

The app should not error out

Comments

  1. Ewan Harris 2017-05-25

    Uglify would keep the code as is
       var res = {
                   milliseconds: 0,
                   months: 0
               };
               res.months = other.month() - base.month() + 12 * (other.year() - base.year());
       
  2. Christopher Williams 2017-05-25

    https://github.com/appcelerator/alloy/pull/826
  3. Christopher Williams 2017-05-25

    [~eharris] Note that this likely means minified builds on the SDK for iOS will have the same issue, as we're using babili to minify there. I think a quick investigation and another ticket likely need to be opened there. I suppose we'll just have to check if we're building for iOS on TiCore *and* minifying and if so, find some way to minify other than babili...
  4. Feon Sua Xin Miao 2017-05-25

    Looks like it's babel-plugin-transform-inline-consecutive-adds.
  5. Ewan Harris 2017-05-26

    [~cwilliams] unsurprisingly you're right TIMOB-24736
  6. Abir Mukherjee 2017-10-10

    Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.13 Appc CLI: 6.3.0-master.7 Alloy 1.10.5 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.2.2 Verified that kitchensink-v2 runs correctly with the above environment.

JSON Source