Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25875] Android: Babel rewrites app.js in classic project to generated ES5 code

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2018-04-03T23:28:32.000+0000
Affected Version/sRelease 7.1.0
Fix Version/sRelease 7.1.1
ComponentsAndroid
Labelsbabel, es6, transpile
ReporterHans Knöchel
AssigneeChristopher Williams
Created2018-03-16T16:29:27.000+0000
Updated2018-04-04T21:12:20.000+0000

Description

I noticed that Babel rewrites ES6 code in the app.js of classic projects to ES5 code (by using the generated code). It was noticed while moving [ti.mapbox to ES6](https://github.com/hyperloop-modules/ti.mapbox/pull/2).

Comments

  1. Christopher Williams 2018-03-16

    So you're saying it transpiles the Resources/app.js to ES5 and writes it to disk at that same location, not under the build folder? But only app.js?
  2. Christopher Williams 2018-03-16

    ohhhh no... I found out what was happening here. Ugh. Transpilation is doing the right thing, but the combination of using symlinks to speed up builds *and* transpiling is messing things up. To be more specific: if you've built before and a file didn't get changed/transpiled, the build may have generated a symlink back to the original source files in the build directory. Then if you later turn on transpilation, the generated contents will get written to the destination location - which is still symlinked back to the original file! This is a CLI fix where we need to be better about the possible combos of symlinking and updating contents. This is ugly.
  3. Christopher Williams 2018-03-16

    7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9939 master: https://github.com/appcelerator/titanium_mobile/pull/9940
  4. Hans Knöchel 2018-03-16

    Thats the issue! I've updated the ticket to indicate that this is an Android only issue and does not seem to appear on iOS. The Mapbox PR was tested with the change as well and it works as expected.
  5. Lokesh Choudhary 2018-04-03

    PR's merged.
  6. Lokesh Choudhary 2018-04-04

    Verified the fix with SDK 7.1.1.v20180404110450 & 7.2.0.v20180403153400. Closing. Studio Ver: 5.1.0 OS Ver: 10.13.2 Xcode Ver: Xcode 9.3 Appc NPM: 4.2.13-2 Appc CLI: 7.0.3-master.27 Daemon Ver: 1.0.1 Ti CLI Ver: 5.1.0 Alloy Ver: 1.11.0 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 9.0.4 Devices: ⇨ google Nexus 6P — Android 8.0.0 ⇨ google Nexus 5 — Android 6.0.1

JSON Source