Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebAssembly helper should return the module #5190

Closed
4 tasks done
RSWilli opened this issue Oct 4, 2021 · 1 comment
Closed
4 tasks done

WebAssembly helper should return the module #5190

RSWilli opened this issue Oct 4, 2021 · 1 comment

Comments

@RSWilli
Copy link

RSWilli commented Oct 4, 2021

Clear and concise description of the problem

emscripten has an instantiateWasm property, where you get the imports and must call the callback with the module, which wont work in vite, because the __vite-wasm-helper returns only Webassembly.Exports

instantiateWasm: (imports, cb) => {
    FFprobewasm(imports as any)
        .then((exports) => {
            console.log(exports) // compilation worked, and the exports are logged

            cb(module) // <- but the callback expects a Webassembly.Module, 
                              // but the helper only returns Webassembly.Exports
        })

    return {}
}

Suggested solution

https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/wasm.ts#L40

this should only return result, if needed, the user can call the properties by himself, but in the current way there is no way to access the module

Alternative

an alternative is to compile the wasm myself, because then I get access to the Module

Additional context

No response

Validations

@bluwy
Copy link
Member

bluwy commented Mar 20, 2022

This looks the same as #5615. I'll close this in favour of that issue (even though this is older), since there's a PR linked that should fix it too.

@bluwy bluwy closed this as completed Mar 20, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants