IIFEs in UI Vision

Hello! I’m building a macro which in some parts invokes an script which should return certain information from the page. My issue is that UI Vision refuses to get the return value from the script when it is inside an inmediatly invoked function expression:

(function() {
    const test = 'works';
    return test;
}());

this returns undefined in UI Vision, while

    const test = 'works';
    return test;

returns the 'works'.

For a simple script like this, this is no issue, but my code uses a few require and it is bundled by Browserify, which means I can’t avoid it as far as I know. Is it impossible to use IIFE into UI Vision or is there any way around this?

I admit I am just guessing here, but does the async version of execute Script work? executeAsyncScript, execute async script - Selenium IDE Commands Tutorial

Good thinking, though the Async version did not work. Neither the sandboxed versions.