Issues with Arrow Functions in Typescript

Issues with Arrow Functions in Typescript
0.0 0

#1

Hello all,

I’m having issues compiling web builds in creator. We’re using Typescript in our project, and unfortunately we’re unable to compile release builds ( debug not checked ). Debug builds build ok.

When I try to run uglify over the debug project.dev.js, it gets stuck on arrow functions.

Are arrow functions not stripped out during the Typescript phase of the build process? The target is specified as ES5, which should mean that arrow functions get converted over to an ES5 compatible function.

Has anyone else encountered this issue? Is no one using arrow functions? Is there something I’ve missed? Any help would be truly appreciated.

Thanks!


#2

Hi, unfortunately, as you have seen, there is not much support here. A few weeks ago I was exited to read @owen saying there would be new tutorials, and texts about performance tips and how they care about Creator (We need a friendly ENGINE, not a dysfunction EDITOR). But they are too busy programming, to provide some support to the foreign developers dealing with new bugs and lack of documentation. Which is very frustrating for some of us trying to create and publish games made with Creator.


#3

I think there used to be more support for english speakers before but some guys got laid off due to financial reasons.
I have a feeling that they do read the english forums since I’ve reported a few bugs that had no replies but did get fixed in a later version. It’s nothing but a hunch though.

Regarding the question from @cmarrin519 I can only say that I have had no problems running non debug builds in various browsers. Are there any specific browsers you are having problems with?


#4

Thanks for the replies!

@phero_constructs It’s not that non-debug builds don’t run in browsers. I can’t even build them. If I try to build my project as a non-debug build, it fails. If I try to use uglifyjs on the debug code, it fails on arrow functions. Which suggests to me that they’re not being removed or handled properly. My question is, is anyone using => functions in their code, and are able to make non-debug builds. If so, what version of Creator are you using? Is it a JS/TS project? As much info as possible to see if I’m missing something somewhere.

Thanks!


#5

I’ve been using typescript and lambda functions since typescript was first supported by CC in a 1.5 beta. I’m currently using the 1.6b1 and, while it has issues related to the editor, I have no typescript problems whatsoever.
I’m using the Mac version.


#6

What Creator version are you using? Creator has a builtin tsc module that will compile Typescript into ES5, which should not leaves any arrow functions in the bundle. Can you provide a demo project that can reproduce this issue?


#7

Hello! Thank you for responding nantas.

Doing some more digging, I found that the arrow function that is not being removed is actually in an npm package we’ve created for the project. This leads me to believe that no processing is done on any files in the node_modules folder, they’re just browserify’d into the project. And that it is up to us to ensure that any module we use is ES5 compatible already.

Please let me know if this is the case, or if there’s a way to ensure that node_modules are processed for ES5 compatibility during the build process.

Thanks again!