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

package generated by wasm-pack import wasm file directly, which does not work in browser #1432

Open
wighawag opened this issue Sep 6, 2024 · 0 comments

Comments

@wighawag
Copy link

wighawag commented Sep 6, 2024

🐛 Bug description

Current generated code make use of import * as wasm from "./<lib>.wasm"
This does not work in browser and require a bundler

🤔 Expected Behavior

I expect wasm-pack to generate package that can be imported without transformation in modern browser

👟 Steps to reproduce

see reproduction repo here : https://github.com/bug-reproduction/wasm-pack-in-browser

git clone https://github.com/bug-reproduction/wasm-pack-in-browser
cd wasm-pack-in-browser
wasm-pack build

Then launch a server:

python3 -m http.server 8888

navigate to http://localhost:8888/

open the console and see

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/wasm". Strict MIME type checking is enforced for module scripts per HTML spec.

🌍 Your environment

Include the relevant details of your environment.
wasm-pack version: .13.0
rustc version: 1.81.0 (eeb90cda1 2024-09-04)

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

1 participant