How to use macro Config with UIkit2?


On my confluence app, I trying to add a macro config following . I use UI KIT V2

1/ In my manifest I added:

        function: config-function
    - key: resolver
      handler: index.handler
    - key: config-function
      handler: index.config

2/ I created a file “config.jsx” in frontend folder

// Function that defines the configuration UI
export const Config = () => {
  return (
      <TextField name="name" label="Pet name" defaultValue={} />
      <TextField name="age" label="Pet age" defaultValue={defaultConfig.age} />

3/ In my index.jsx in frontend folder I added :

import ForgeUI, {
} from "@forge/ui";

const defaultConfig = {
  name: "Unnamed Pet",
  age: "0"
export const config = render(<Config />);

The problem is when I execute “forge deploy” the result is:

Running forge lint...
No issues found.

× Deploying helloWorld to development...

i Packaging app files

Error: Bundling failed: Module not found: Error: Can't resolve 'buffer' in 'C:\Users\thibault\Web project\helloWorld\node_modules\safe-buffer'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
        - install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "buffer": false }

Rerunning the command with --verbose may give more details.

I don’t understand

It’s confusing between UIKit and UIKit2.
The solution is :

add config: true in manifest.yml

1 Like