jpemartins / speex.js

Speex codec in Javascript. Mirror from https://code.ua.pt/projects/speex-js
214 stars 63 forks source link

Unable to bundle using Webpack 5. #33

Open grkblood13 opened 2 years ago

grkblood13 commented 2 years ago

First off, this has been a very reliable decoder for many years and still continues to be so thank you for building it!

I'm currently looking into the possibility of bundling this into a module to make deployment simpler on the end user when additional dependencies start coming into play. For testing purposes I've made a simple example and put it at this repo:

https://github.com/grkblood13/webpack-speex

When I load the built bundle into the browser I get the following error:

speex.js:40215 Uncaught ReferenceError: util is not defined
    at eval (speex.js:40215:1)
    at eval (speex.js:40339:2)
    at Object../src/speex.js (bundle.js:29:1)
    at __webpack_require__ (bundle.js:63:42)
    at eval (index.js:2:67)
    at Module../src/index.js (bundle.js:19:1)
    at __webpack_require__ (bundle.js:63:42)
    at bundle.js:115:37
    at bundle.js:117:12

Any idea on how to resolve this?

grkblood13 commented 2 years ago

The webpack group responded to this on a ticket I opened there and said speex.js will need to be rebuilt in order for this to work. If this is something you'd be willing to tackle @jpemartins it may also be a good time to look into a wasm version as well.

webpack response: https://github.com/webpack/webpack/issues/15893#issuecomment-1145809947