Can my config file connect to Confluence to set up its fields?

I’m developing a macro which will show details about multiple spaces on my Confluence. I’d like the admin to be able to specify which spaces it shows. My plan for this was to set up a config file (config.js), and then instead of having a static form, to get a list of all the spaces in my site, and list them all with checkboxes, so the admin can just check the ones that are to be shown to users.

I can’t figure out how to get the list of spaces. I’ve tried the following:

Invoking a resolver function, which is defined in src/index.js (just in the same way that my actual App.js would invoke a resolver function. This didn’t throw errors, but didn’t seem to complete either.
Using requestConfluence in config.js and loading the list of spaces directly. This gave the message "Error: Can’t resolve ‘@forge/bridge’ in ‘/app/src’
Using the api - again this didn’t work; I think it gave the error “Can’t resolve ‘@forge/api’ in ‘/app/src’”.

Is there a way to do this, and if so, can someone suggest what I need to do?