httptoolkit / brotli-wasm

A reliable compressor and decompressor for Brotli, supporting node & browsers via wasm
Apache License 2.0
264 stars 21 forks source link

Add an asset entry point #31

Open pimterry opened 1 year ago

pimterry commented 1 year ago

@pimterry , I are recently working on another kind of entry for the web environment of these packages with less "side-effects". It is in asset.js with another export in package.json, the document is at asset.md, and an example is available at example/webpack-asset. Do you think it is fine and can I open a PR for the new entry?

Originally posted by @myl7 in https://github.com/httptoolkit/brotli-wasm/issues/18#issuecomment-1824427485

pimterry commented 1 year ago

Just pulling this out as a separate topic @myl7, to avoid confusing that thread too much.

Can you explain more about how this works, and exactly why it's useful?

Is there a good reason why we'd need to do this here, instead of fixing the target (or adding a new target) in the wasm-pack project itself?

I'd really like to avoid maintaining more and more complicated entrypoints if we can - it would be much better if wasm-pack could handle this properly. That's less maintenance for each of us on these packages, but would also make it much easier for everybody else building wasm packages elsewhere to do the same thing automatically.