wasm_split_cli_support 0.2.2

Split a WASM module into lazily loadable chunks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function makeFetch(srcUrl) {
    if (srcUrl === undefined) {
        return () => { return async (_imports) => { return {} } };
    }
    return () => {
        const src = fetch(srcUrl);
        return async (imports) => {
            try {
                return await WebAssembly.instantiateStreaming(src, imports);
            } catch (e) {
                if (e instanceof WebAssembly.LinkError && e.message.includes("__canary")) {
                    console.error("wasm-split: It looks like you are trying to load a split module that does not belong to the same compilation unit. This is not supported.")
                }
                throw e;
            }
        }
    }
}