I've been pulling in my composeApp as a module usi...
# compose-web
a
I've been pulling in my composeApp as a module using the autogenerated "composeApp.mjs" so that I can grab it as a module and call kotlin from javascript. However that import intermittently fails (as in your compose wasm app does not start) with error like "can't find the function _malloc in compose and skiko." I think I've narrowed it down to my app (the internal compose parts) calling skiko before its really up. So I reworked the composeApp.mjs (with AI help) to wait for skiko to fully come up first:
Copy code
import * as skiko from './skiko.mjs';
import * as joda from '@js-joda/core';
import { instantiate } from './composeApp.uninstantiated.mjs';

export async function initComposeApp()
{
    if (skiko.ready)
    {
        await skiko.ready;
    }
    else if (typeof skiko.instantiate === "function")
    {
        // fallback for older skiko
        await skiko.instantiate();
    }
    const { exports } = await instantiate({
        './skiko.mjs': skiko,
        '@js-joda/core': joda
    });
    return exports;
}
So far it appears to be working. I figured I'd post this here, because I think anyone else who is trying to use their composeApp as a module will hit the same problem.