It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to Compress ES6 files with maven for an Jira Plugin

Hi,

I have an ES6 compliant JS file, which I am trying to include in my Jira Plugin. unfortunately, when i run atlas-package the following error occurs.

 

[INFO] --- maven-amps-plugin:6.3.1:compress-resources (default-compress-resources) @ risk-management ---
[INFO] Compiling javascript using YUI
[ERROR] syntax error
AJS.toInit($ => {

[ERROR] Compilation produced 1 syntax errors.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.311 s
[INFO] Finished at: 2017-06-08T14:44:42+01:00
[INFO] Final Memory: 39M/300M
[INFO] ------------------------------------------------------------------------

 

I tried to insert this Code snippet in the Chrome console and it just works like a charm. Is there a way to use ES6 or do i have to use the old ways of JS?

1 answer

After some search I came to conclusion that using

<compressResources>false</compressResources>

option in maven-amps-plugin configuration is the only way right now. 

amps plugin comes with yuicompressor v2.4.7 from ancient 2012's

for JS compression you can use any other plugin or just don't use compression.

Sadly no way to use Google Closure Compiler 

Waiting for an update from Atlassian team

Actually you can, if you want to take a little detour. With the help of this maven plugin Frontend Maven Plugin you can use Node for transpiling your JS files. You just have to update your pom.xml accordingly. You could also use webpack and JS frameworks like react, angular and sorts. It takes a while to setup, but it works really well if you want to use those new Technologies.

Like Sergi Dehesa likes this

hello Chris,

i also want to use ES6 in my Plugin development,i only want the code to compile,i have no need to another Framework,so as i understand i have to add the dependency to my pom file,is there any special configuration i have to do ? 

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you