Minimal example making webpack and wasm/Emscripten work together.
Build instructions:
- Clone this gist
npm install
npm start
- Open
http://localhost:8080
- Look at console
Note: Docker is required to build this project.
I filed a bug with webpack to make this integration easier.
More questions? Hit me up on Twitter.
License Apache-2.0
<3 Surma
Came back to add another update, used this technique to successfully load a
.wasm
file from a location other than the same directory as the.js
file that Emscripten generates to load said.wasm
file.My issues was effectively the same as this question:
https://stackoverflow.com/questions/46332699/how-can-i-load-wasm-files-stored-in-a-subdirectory
Some differences I experienced / gotchas:
publicPath
for the file-loader config is incorrect fetch requests for the.wasm
file will fail (404) causing the streaming compilation to fail (expected magic word 00 61 73 6d
) as it tired to load the response, so double check that this is correct.exports-loader
, not sure if this will cause issues later, hopefully not!Many Thanks!