Tschrock / esbuild-plugin-wasm

WASM module loader for esbuild
MIT License
24 stars 5 forks source link

specify end point to query wasm binary from #4

Closed Lunarequest closed 1 year ago

Lunarequest commented 1 year ago

It seems the current way the wasm binary loads is it finds the current page url and queries from one domain up, however in my case I load everything from a /static/js folder and this auto detection instead uses the current page url which breaks stuff. A param to specify to query at /static/js would be very useful, would this be possible?

Tschrock commented 1 year ago

Ah, I assumed esbuild would give me the full path to the wasm file, but it's just giving the path relative to the output directory. I've pushed an update to have the file fetched from the script's location rather than the page since that seems to make more sense. If you need more control over the location, you can also use esbuild's publicPath option to specify a prefix.

Lunarequest commented 1 year ago

can confirm it works!