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

Wasm initialization missing using npm run build #54

Open
finnbear opened this issue Feb 5, 2024 · 4 comments
Open

Wasm initialization missing using npm run build #54

finnbear opened this issue Feb 5, 2024 · 4 comments

Comments

@finnbear
Copy link

finnbear commented Feb 5, 2024

I used this plugin to import the @dimforge/rapier3d physics engine, which uses WebAssembly internally. Everything works as expected when I run npm run dev. However, npm run build produces a dist/ directory with a .wasm file but no WebAssembly.instantiate*() of any kind in the .js file(s). As a result, an error is emitted the first time the nonexistent WebAssembly instance is accessed.

Here is a reproducible example: https://github.com/finnbear/vite-plugin-wasm-bug

image

Thanks for making this plugin!

@crasite
Copy link

crasite commented Mar 7, 2024

Hello, have you found any workaround for this issues?

@MaxBittker
Copy link

Has anyone else found a solution for this?

@MaxBittker
Copy link

i worked around this with the compat build

@finnbear
Copy link
Author

finnbear commented Mar 27, 2024

I used https://www.npmjs.com/package/@dimforge/rapier3d-compat as a workaround. The downside is it includes the Wasm binary as base64, which is less efficient for size and speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants