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 bundles fail when loaded via file://
URLs
#7918
Comments
I think that's something that browser should change. I'm not very familiar with Electron, could we load the wasm module using node and |
Btw here's a previous discussion: WebAssembly/design#1200 |
I'm admittedly totally unfamiliar with |
Emscripten's boilerplate to load WebAssembly modules handles this situation with a graceful fallback to ArrayBuffer instantiation. A similar approach could be applied here in webpack. I tested this solution in the webpack output and it solved my problem in Electron. If anyone with more (any) webpack contribution experience would like to fix this via PR I would be forever grateful, otherwise I may be able to make time to take a crack at it. |
Yep send a PR |
I've started a PR, but it could use some assistance (I'm not sure what exactly is or would be failing in the integration tests). If anyone's able to help that would be great, otherwise feel free to use it as a starting point. |
Thanks @bspeice for the PR. Maybe we can override |
This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days. |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
Apologies for not responding - I'm not a JS developer so would have no idea how to safely apply an override like that. If everyone's committed to that path, I'd need some help. |
This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
/cc @vankop fixed in webpack@5? |
Feel free to report a bug if does not work. |
Can confirm, everything does seem to be fixed in webpack 5. |
@bspeice thanks! |
One quick clarification after I did some further testing: while Webpack 5 does contain fixes needed to load WASM blobs asynchronously, it doesn't change the underlying issue ( |
@bspeice Can you open a new issue with reproducible steps? |
@evilebottnawi: no need for a new issue. My intention was to clarify that the underlying issue was Chrome-related, and thus not something webpack could fix. The combination of browser and webpack changes that have come since this issue was opened make it so that everything works correctly. No further work needed, thanks all for the assistance. |
Bug report
What is the current behavior?
Electron apps fail to load WASM code because WASM bundles served via
file
URL's aren't allowed to be loaded viainstantiateStreaming
(specifically because MIMEapplication/wasm
must be set.If the current behavior is a bug, please provide the steps to reproduce.
No configuration is specifically necessary, but I've included a reproducing project at this git repo. To run:
Running will require a recent Rust nightly build, but I'm happy to add the bundle files if necessary to skip that step.
What is the expected behavior?
Webpack would detect that file URLs are not eligible for inclusion via
instantiateStreaming
and prioritize filling thearrayBuffer
andinstantiate
ing that instead.Please note that I can specifically reproduce the correct behavior by snipping out the
else if(...) WebAssembly.instantiateStreaming
branch. I'm not sure what the right way of fixing this is, but I'm happy to work on a PR if someone can point me in the right direction.Other relevant information:
webpack version: 4.16.5
Node.js version: 8.10
Operating System: Linux
Additional tools: Rust nightly
Alright, some updates after I spent more time looking at this: the actual URL request goes to ".wasm", so adding checks for "./" or "file://" don't fix this specific issue (though may not be a bad idea in general). Is this something that should potentially have a config value added instead, where we can disable streaming load?
The text was updated successfully, but these errors were encountered: