-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
WMR does not load WASM files from node_modules #412
Comments
Ah yes, we're filtering out wasm by accident. Barring that, you can use the URL prefix to load WASM: import url from 'url:./foo.wasm'; |
@developit Thanks for the answer, however it seems it doesn't apply to WASM files inside rm -r your-project-name
yarn create wmr your-project-name
cd your-project-name
mkdir node_modules/test
curl -L https://github.com/mathiasbynens/small/raw/master/webassembly.wasm > public/test.wasm
echo '{"name":"test"}' > node_modules/test/package.json
echo 'export { default } from "url:test/test.wasm";' > public/index.js
yarn wmr build
It does work for WASM file in the same directory (as in your example), so there's something related with the path resolution of |
Ah yeah that's possible. Is this after running npm install to ensure the file is there? We don't currently stream wasm to disk during auto-install. |
Running |
Describe the bug
WMR doesn't work well with packages that ship WASM binaries. I'd like to bundle a WASM file with my application and give its URL to the Emscripten module that loads it, but it seems WMR doesn't let me do that.
To Reproduce
This produces the following error message:
Expected behavior
I would expect WASM file to be treated as any other file. If there's a good reason to treat them differently, I'd like to find documentation on why this is not the case, and ideally having an option to chose which behaviour I want.
Additional context
If I want to do the same thing with Rollup, I have to use the
@rollup/plugin-url
:I don't know if it's related, but I've also noticed that if I try to use a npm package that includes a WASM binary
yarn add
it, the WASM file is not even downloaded.The text was updated successfully, but these errors were encountered: