could not load "mediainfo.wasm" in electron rendererSee original GitHub issue
GET //mediainfo.wasm net::ERR_FILE_NOT_FOUND index.html:1 Uncaught (in promise) TypeError: Failed to fetch
mediainfo.js:874 GET http://mediainfo.wasm/ net::ERR_NAME_NOT_RESOLVED Uncaught (in promise) TypeError: Failed to fetch
I’m using electron and react.
and import mediainfo.js from App.js with this line.
import MediaInfo from "mediainfo.js";
I put mediainfo.wasm file into /public directory, but not works.
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Thanks for sharing the test repository.
The issue is not related to electron. Your webpack build doesn’t include
mediainfo.wasm. If you investigate using the browsers developer tools, you can see that the request for
mediainfo.wasm is 200 success, but your app returns some HTML page, not the wasm file. Thus you’re getting the magic word error.
https://mediainfo.js.org/ is a React app bundled with webpack. You can use it as a reference. I also published the code for it. To solve the problem I chose to customize the webpack configuration so that
mediainfo.wasm is copied over to the destination folder (using the
locateFile function is part of the emscripten loader code. I think they tailored it towards being used inside a real browser context. It might be that you need to patch the code in order to make electron find the