I have developed a plugin for Bitbucket using Java and React. The plugin is written in Java version 8 and React version 16.8.0. The targeted Bitbucket version for this plugin is 5.16.0. However, when I attempt to test the plugin with different Bitbucket versions in a standalone environment, the React components fail to render successfully on the page.
Can you please provide details of your approach including entries in atlassian-plugin.xml etc. On which bitbucket pages do you want to display plugin content and what errors you see in the browser when your react components are rendered.
Thanks for your helping.
my weppack.config.js file contents are,
const webpack = require('webpack');
const path = require('path');
const WRMPlugin = require('atlassian-webresource-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const PLUGIN_TARGET_DIR = path.join(__dirname, '..', '..', 'target');
const OUTPUT_PATH = path.join(PLUGIN_TARGET_DIR, 'classes');
const WEBPACK_JS = path.join(__dirname, '..', 'main', 'resources', 'js', 'webpacked');
module.exports = {
context: __dirname,
entry: {
'git-management-init': path.join(__dirname, 'git-management-init.js'),
},
output: {
filename: 'bundle.[name].js',
path: WEBPACK_JS
},
resolve: {
extensions: ['.js', '.jsx', '.tsx']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-react", "@babel/preset-env"],
},
},
}
]
},
plugins: [
new WRMPlugin({
providedDependencies: {
'wrmi18n': {
dependency: 'com.atlassian.plugins.atlassian-plugins-webresource-plugin:i18n',
import: {
var: 'require("wrm/i18n")',
amd: 'wrm/i18n',
}
}
},
pluginKey: 'key',
contextMap: {},
xmlDescriptors: path.resolve(OUTPUT_PATH, 'META-INF', 'plugin-descriptors', 'wr-defs.xml')
}),
new webpack.DefinePlugin({
'process.env': {
ENV: 'production'
}
})
],
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
mangle: {
// Don't mangle usage of I18n.getText() function
reserved: ['I18n', 'getText'],
},
},
}),
],
},
};
my atlassian-plugin.xml resource content,
<web-resource key="git-management-resources" name="git-management Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-message</dependency>
<resource type="download" name="git-management.css" location="/css/git-management.css"/>
<resource type="download" name="git-management-init.js" location="/js/webpacked/bundle.git-management-init.js"/>
<resource type="download" name="images/" location="/images"/>
<context>bitbucket.page.pullRequest.view</context>
<context>git-management</context>
</web-resource>
Looking at your code more questions arise: Did you perhaps follow the Bitbucket client side extensions guide? That’s only for Bitbucket 7, 8, … . You must use a different approach altogether for BB 5 & 6.
@UlrichKuhnhardtIzym1 Hello, I want to work on Bitbucket client side extensions, but when I try to run it after installing it on my computer, it gives me this error;
A fatal error has occurred
The following problem occurred, which prevents Atlassian Bitbucket from starting:
- Git was not found on the PATH for Bitbucket. Install Git 2.11.0+, excluding 2.12.2, and restart Bitbucket.
I tried many ways but I couldn’t get the result.
Looks like you installed Bitbucket 7 or 8 now? Bitbucket relies on a local git installation of a certain range of versions , which I think is missing on your machine.
Check your local git installation version and executable location with git --version
and which git
(for linux-like systems). The git executable path should be present in your PATH
environment settings.
For example on my machine I have git version 2.35.1 and the git executable location is
$ which git
/usr/local/bin/git
$ echo $PATH
/usr/local/bin:/usr/local/sbin .....
You should see something similar.
@UlrichKuhnhardtIzym1
my git version : 2.41.0.windows.3
Node 12.19+ : v18.17.0
Java JDK 1.8 : 1.8
ATLAS Version: 8.2.7
ATLAS Home: C:\dev\tools\atlassian\atlassian-plugin-sdk-8.2.7
ATLAS Scripts: C:\dev\tools\atlassian\atlassian-plugin-sdk-8.2.7\bin
ATLAS Maven Home: C:\dev\tools\atlassian\atlassian-plugin-sdk-8.2.7\apache-maven-3.5.4
AMPS Version: 8.1.2
<bitbucket.version>7.17.9</bitbucket.version>