[TIMOB-25875] Android: Babel rewrites app.js in classic project to generated ES5 code
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-04-03T23:28:32.000+0000 |
Affected Version/s | Release 7.1.0 |
Fix Version/s | Release 7.1.1 |
Components | Android |
Labels | babel, es6, transpile |
Reporter | Hans Knöchel |
Assignee | Christopher Williams |
Created | 2018-03-16T16:29:27.000+0000 |
Updated | 2018-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).
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?
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.
7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9939 master: https://github.com/appcelerator/titanium_mobile/pull/9940
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.
PR's merged.
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