dbankier / TiShadow

Quick Titanium previews across devices
http://tishadow.yydigital.com
Other
385 stars 122 forks source link

Issue with ES6 and transpile option #551

Closed yahya-uddin closed 5 years ago

yahya-uddin commented 5 years ago

Titanium has a transpile option that allows writing in ES6 as described in this post:

https://www.appcelerator.com/blog/2018/06/using-es6-in-a-titanium-app/

But I can't seem to get it to work on TiShadow.

When I create even a empty class like:

class A {

}

I get this error:

[ERROR] Unexpected token: name (A)

But normal compiles work just fine such as:

appc run -P android
appc alloy compile --config platform=android

Perhaps the transpile option in the tiapp.xml of the app is not being passed through the tishadow compiler in: https://github.com/dbankier/TiShadow/blob/master/cli/support/compiler.js

yahya-uddin commented 5 years ago

Any update on this?

dbankier commented 5 years ago

Might be tricky to get working. I think AppC transpiles on build. TS just pushing the source code to the device (after Alloy complie). I have been using JAST for longer than this for ES6 with TiShadow.

yahya-uddin commented 5 years ago

Any reason why the transpile option is not being recognised by tishadow? Is it reading a different tiapp.xml file or something?

dbankier commented 5 years ago

I think you need to understand how both Ti and TS work under the hood. Ti only transpiles when doing a final build. When TS pushes code to the device (or even the initial 'build') it will compile the alloy to js then bundles and sends it to the device. The transpiling is therefore skipped.

yahya-uddin commented 5 years ago

Oh darn. That's annoying. Do you think it's worth asking Appcelerator on Jira for a feature request so that we can transpile as well in the initial build.