anthumchris / opus-stream-decoder

Instantly decode Ogg Opus audio streams in chunks with JavaScript & WebAssembly (Wasm)
124 stars 21 forks source link

React init path seems to be broken #10

Closed nimeshamin closed 4 years ago

nimeshamin commented 4 years ago

I'm not sure if it's intended for this to work in a React app, but I'm seeing issues with with init after overriding the locateFile function for Emscripten, so wasm is being found appropriately. Current failures are at setting the ctor of the exported function, where global and exports are not defined. Environment is React/Typescript/Webpack4

anthumchris commented 4 years ago

Some build processes may require a custom task to copy over any files to be found by the webapp. I did this in https://github.com/AnthumChris/fetch-stream-audio/blob/master/scripts/build.sh when using Parcel for https://fetch-stream-audio.anthum.com/

nimeshamin commented 4 years ago

I was able to get the wasm to be included with webpack by importing the wasm file, then returning the renamed filepath to Module.locateFile. The Emscripten output should just work at this point.

anthumchris commented 4 years ago

Hi @nimeshamin. If it's ok with you, I'd like to close this out since it's more related to React than this specific repo. Sorry that I can't be of more assistance with your project.