Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

import javascript methods from different files

Aymen Maamri June 19, 2020

hello,i'm currently developing a Plugin for Jira,i have a JavaScript service file and i want to export some methods so other files files can use them.both files are declared as a resource in atlassian-plugin.xml

when i try to import them from my main JavaScript file and run the plugin i receive this error :

[INFO] Compiling javascript using YUI
[ERROR] syntax error
export function sayHello() {
[ERROR] syntax error
console.log("####################TEST Import######################################################################################");
[ERROR] syntax error
};
[ERROR] Compilation produced 3 syntax errors.

is it possible to import methods or do i have to write all my code in one file ?

 

1 answer

0 votes
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 24, 2020

Hello @Aymen Maamri ,

First of all, let me mention that this is not the best place to get support on development related topics and that I might not be the best person to answer this question. The right resources are listed in https://developer.atlassian.com/resources.

Specifically:

 

Also:

  1. This thread has been created in the Jira Cloud Free collection, but atlassian-plugin.xml is used to build plugins for Jira Server. Can you kindly clarify what you are using, Server or Cloud?
  2. The error returned just says "Test Import" surrounded by a lot of # symbols and it does not tell us much. Also, it does not look like a standard error message. Is this a string you have written somewhere in your code/files? 
  3. You say that you have declared your files as external resources but we cannot actually see how. For example in Example of Resource Type: Stylesheet referring to Images I can read:

    Note: If you have multiple stylesheets and javascript resources defined, you should put the resource defintions in a Web Resource Module.

    To refer to your plugin images in a stylesheet, use a relative path based on the resource name defined for the image (which is 'my-images' in this case).

    Are you doing this or anything different? 

     

 

Finally, similar topics have been discussed in below threads. Please review them since you might find your answer in there: 

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events