How to declare ES6 js modules in Server plugins

Hi all,

I’m in the process of porting my Cloud and Server apps from pure vanilla .js to multiple ES6 .js modules. Primarily I’m looking to create re-usable components between generalPages, reports, dashboards etc.

From a cloud (Connect) perspective, this is fairly straight forward; just add ‘type=module’ to your main .js script and you’re off to the races.

However, I’m unsure of what the equivalent is in the server (SDK) space. In the atlassian-plugin.xml file the ‘type’ variable is already declared as ‘download’ when listing .js resources, example below:

 <web-resource key="jira-basic-view-resources" name="jira-basic-view Web Resources">
     <resource type="download" name="foo.js" location="/js/foo.js"/>

Is there a way to properly declare .js resources as an ES6 module? Ideally I’d like to avoid using transpilers like webpack if possible, and I’ve already tried implementing frontend-maven-plugin but for the life of me couldn’t get it running.



AFAIK there is no support for type="module" in dc/server at the moment. But modern frontend configuration is likely to be added to plugin structure in the future (so you don’t have to do it manually).

Currently you would have to use a transpiler and frontend-maven-plugin.
If you have Jira source code, you can look at jira-frontend-plugin within it as an example for setting up modern frontend in Jira server plugin using Webpack and atlassian-webresource-webpack-plugin.

I also found this talk from a past conference about similar topic:

1 Like

That’s right. It is tracked here

1 Like

Thanks @tjoy & @dennis.fischer, good to know I’m at least in the right frame of mind and that this is being talked about internally.