I’ve built a basic “Hello World!” macro using forge (forge create using Custom UI and the template ‘confluence-macro’). I’ve deployed and installed it and it shows “Hello World!”.
Now I want to add configuration (starting with something really basic, like just a text field allowing the user to change the displayed text, but I eventually want the whole thing to be more complex). I followed the steps here: https://developer.atlassian.com/platform/forge/add-custom-configuration-to-a-macro/?tabId=4&tab=custom+ui
but when I come to deploy it I get the error missing resource ‘static/config/build’ is being referenced by ‘macro-config’ in resources - I assume this is because there’s no build folder in static/config. But how do I ‘get’ a build folder? I tried running npm install and then npm run build in static/config, but that doesn’t work (presumably because there’s no package.json). Am I missing a step somewhere? I’ve gone through it a few times and can’t see anything that I’ve missed.
I also tried forge create with the confluence-macro-with-custom-configuration template, but ran into the same issue. Any help appreciated. Thanks!
Hey,
You can go to static/config and run npm install && npm run build command which will generate this build folder for you.
1 Like
Thank you, but I tried that and it didn’t work (install ran but didn’t do anything, and then build didn’t work because there’s nothing to build). My static/config folder only has the src folder in it, which has App.jsx and index.jsx - there’s no package.json or anything like that. I think there should be more in there, but I literally followed the directions on the page and they only said to create those 2 files.
You can create a new react project using vite on the static folder and basically copy the contents of the config to newly created project. Also vite by default uses dist folder for builds so, you would also need to edit the manifest file with static/newproject/dist
1 Like
Thanks! Here’s what I’ve done now:
- In
static, removed all the config stuff that I’d set (so back to just the original confluence-macro version of things)
- Still in
static, ran npm create vite@latest chose a name, then ‘React’ for the framework, JavaScript + React Compiler for the variant (no idea whether that’s right, but it seems to be ok), No to using Vite 8, and then Yes for Install & start now
- Once that had run, I copied the code for
App.jsx (from the Atlassian page) to the App.jsx file in the newly-created folder. The code given for index.jsx seemed to be the same as what was already in main.jsx, so I left that alone. From within the folder I ran npm install @forge/bridge and then npm install followed by npm run build. That created a dist folder.
- In
manifest.yml, updated the path from static/config-name/build to static/config-name/dist (I already had the other config-related changes in there from earlier).
Once I’d done that, forge deploy and forge install worked. When I add the app to a page, it appears (with Hello World), and there’s an ‘Edit’ button, but when I click the ‘Edit’ button I just see a blank square pop up (I guess this is where the configuration form is supposed to appear?).
So it’s nearly there, but I feel like I’m still missing a step?