Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

TypeError: wasm is undefined when package name is not wasm and using a bundler #3560

Closed
lafkpages opened this issue Aug 17, 2023 · 1 comment
Labels

Comments

@lafkpages
Copy link

Describe the Bug

When running some functions that I have exported from Rust, I get TypeError: wasm is undefined. I noticed that this error gets thrown from inside the getUint8Memory0 function, so only functions that need it throw this error.

I also noticed that my Wasm package wasn't called wasm, and wasn't at node_modules/wasm. Renaming it back to wasm fixed everything.

Steps to Reproduce

See lafkpages/wasm-bindgen-error-repro.
This is a simple example that uses SvelteKit and Vite for a bundler, and produces the error described above (tested on Firefox 116). If you git reset --hard the latest commit in the repo, everything works fine.

Expected Behavior

I should be able to name my package whatever I want with no problems.

Actual Behavior

I can only call the package wasm or I get the above errors.

Additional Context

All above ^^

@lafkpages lafkpages added the bug label Aug 17, 2023
@lafkpages
Copy link
Author

Also worth noting that this error disappears when building, it only happens in dev mode.

@rustwasm rustwasm locked and limited conversation to collaborators Aug 20, 2023
@daxpedda daxpedda converted this issue into discussion #3563 Aug 20, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant