Expand my Community achievements bar.

SOLVED

Using TypeScript in AEM Clientlibs

Avatar

Level 1

Hi, 

i tried using TypeScript directly in clientlibs like explained in here:
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/develo...

I tried following steps explained in documentation and its not working for me.

I created cq:ClientLibraryFolder, modified jsProcessor as shown in their example (Typescript to Preprocess and Then GCC to Minify and Obfuscate), but when code is compiled to js its throwing "Uncaught SyntaxError: Unexpected identifier" for any typescript syntax. 

 

Does anyone have experience or examples using TS directly in clientlibs without using any additional, external compilers?

 

I found this post where it says that gcc is not working on 6.4, are there any updates on 6.5 or cloud version?

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-4-2-gcc-js-processor...

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @edisincek ,

The support issue which this post is referring to is for ES6. Unfortunately, TS would need to be compiled into JS before it can be read/executed by a browser. 

You would need an external compiler for this scenario.

 

I would suggest you move this TS to the ui.frontend modeule as TS is supported there and you can then build it through webpack and move the minified & compiled JS to CRX.

 

https://aemcorner.com/ui-frontend-and-typescript/ 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @edisincek ,

The support issue which this post is referring to is for ES6. Unfortunately, TS would need to be compiled into JS before it can be read/executed by a browser. 

You would need an external compiler for this scenario.

 

I would suggest you move this TS to the ui.frontend modeule as TS is supported there and you can then build it through webpack and move the minified & compiled JS to CRX.

 

https://aemcorner.com/ui-frontend-and-typescript/