Hello,
I am developing a custom plugin and it works fine when I run it locally. All web resources are loaded.
But when I upload the plugin jar or obr file to my jira test server, I got this error from the browser Uncaught ReferenceError: toggleComponent is not defined, where toggleComponent is one of the function in my js file. When I checked the web resources e.g: js,css files are empty.
Here is how I define the web resources at the atlassian-plugin.xml:
Removing the / at the beginning of the web resource location. Result: web resources are still empty
Adding <context>atl.general</context> and <context>atl.admin</context> while removing $webResourceManager.requireResource("org.autosar.jira.plugins.change-documentation-console:change-documentation-console-resources") Result: web resources are not loaded at all
Adding alert() function to check if it will be executed. Result: alert() is not executed, because js file is empty.
AJS.$(document).ready(function() {
alert(âJS Controller is loadedâ);
});
Iâm running out of ideas. Any help is much appreciated.
Thanks!
Can you try it out with a single word for the context, like maybe <context>cdc<context> ?
And then add this line in the <head> tag of your template $webResourceManager.requireResourcesForContext("cdc")
thanks for the answer. However, changing the context to a single word and adding $webResourceManager.requireResourcesForContext("cdc") to my .vm template still doesnât solve the issue. The web resources are not loaded at all in this case.
@Taylan Ok understand, I only have 1 web resource.
Hi @madamczak yes the js file is located exactly as your example. I follow through the steps you gave to check if the modules are enabled and the web resources module is there and enabled.
From the browserâs dev tool network, I can see that the css and js files are loaded but the js file only contains
Hi @tjoy, No I donât have a CDN set up for my Jira test instance. Also, can you elaborate more on the step of disabling the batch mode? What do you mean by pressing âBâ on Jira dashboard?
In development mode, you can use the keyboard shortcut âbâ to disable resource batching and load resources individually.
Currently it looks like the error has something to do with batch files not being found (404)
I donât have this issue on the development mode. I am able to run the plugin successfully on the development mode. I only encounter this issue when I deploy my plugin on the remote JIRA server.
after some time digging, I found out the reason for this issue is that there were some part of my code which are not accepted by the js minifier that leads to syntax errors when deploying to the server. After rewriting this part of code, the js file is now loaded and not empty.
Thanks everyone for the support. I will therefore mark this as solution.