brotli-wasm icon indicating copy to clipboard operation
brotli-wasm copied to clipboard

Fails on Cloudflare Workers build

Open derekperkins opened this issue 4 years ago • 6 comments

The browser version relies on document (not available) The node version relies on the core util module (not available)

cc @tannerlinsley

derekperkins avatar Dec 03 '21 23:12 derekperkins

Interesting! I wasn't aware of this, I haven't used Cloudflare Workers at all.

I'd happily support Cloudflare Workers if possible, but I'm not sure exactly what environment checks would work for that case. Could you look into it, and open a PR?

pimterry avatar Dec 07 '21 12:12 pimterry

The good news is that it's not too difficult. Library authors just need to expose an API entry point where one can pass in a WebAssembly.Module. You can see a cloudflare worker that brotli compresses in a sample project of mine: https://github.com/nickbabcock/cloud-functions/tree/a44260fdbdeab4edda3ca8c84227217bd9dbfb3d/src/brotli

(I'm not a user of this library, but I just happened to see this issue and know of a solution).

nickbabcock avatar May 17 '22 11:05 nickbabcock