Hey together,
so I’m trying to develop an application that uses some advanced react components. I know, they might not fit to the UI that much but the actual reason for me is, they’re already validated and tested.
So I’ve set up some test project first where I want to get the WebResource stuff working with that.
I created a little example, mostly looking at posts like Developing a JIRA add-on like it's 2016 - Atlassian Developer Blog and similar.
The code seems to work when running it in the Webpack dev server but the converted file is empty when actually opening my page in JIRA.
My plugin.xml
<!-- add our web resources -->
<web-resource key="jira-advancedwf-resources" name="jira-advancedwf Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="jira-advancedwf.css" location="/css/jira-advancedwf.css"/>
<resource type="download" name="jira-advancedwf.js" location="/templates/jira-advancedwf.js"/>
<resource type="download" name="reactTest.js" location="/client/reactTest.pack.js"/>
<resource type="download" name="images/" location="/images"/>
<context>jira-advancedwf</context>
</web-resource>
Note: The first js-file is loaded, so I think I can exclude an error there (I’ve a test flag shown with that and it’s working). So basically it appears like that (tested with the network console of both Chrome and FF):
;
/* module-key = 'com.scholledev.jira.advancedwf.jira-advancedwf:jira-advancedwf-resources', location = '/templates/jira-advancedwf.js' */
function testalert(){alert("test alert")};;
;
/* module-key = 'com.scholledev.jira.advancedwf.jira-advancedwf:jira-advancedwf-resources', location = '/client/reactTest.pack.js' */
;
My Webpack Config for production:
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: {
reactTest: ['./src/reactTest.jsx']
},
output: {
path: path.join(__dirname, '../src/main/resources/client'),
filename: '[name].pack.js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
],
},
};
Also note: I checked that my transpiled file is not empty. So I guess somehow my maven does something here that “removes” (or ignores) the content of the file.