wasm-tool / parcel-plugin-wasm.rs

wasm-bindgen support for Parcel bundler
MIT License
66 stars 16 forks source link

Node.js support #9

Closed mvlabat closed 5 years ago

mvlabat commented 5 years ago

Currently the bundler doesn't support node.js targets. Injected WASM loader code uses fetch API, which is available only for browsers.

Trying to run built scripts fails with the following error:

ReferenceError: fetch is not defined
    at init (/Users/mvlabat/js/muddle-run/backend/dist/index.js:3915:32)
    at loadWASMBundle (/Users/mvlabat/js/muddle-run/backend/dist/index.js:3931:20)
    at loadBundle (/Users/mvlabat/js/muddle-run/backend/dist/index.js:3718:30)
    at Array.map (<anonymous>)
    at Function.loadBundles [as load] (/Users/mvlabat/js/muddle-run/backend/dist/index.js:3688:30)
    at Object.parcelRequire.0 (/Users/mvlabat/js/muddle-run/backend/dist/index.js:3935:158)

I think we also should test "electron" build target and extend this issue if needed (haven't got a chance to do it myself yet).

catsigma commented 5 years ago

Thanks for the issue.

But recently I don't have enough time for this, if anyone could create a PR for this, I'll merge it.

If no one would like to create a PR to fix it, I'll do the job but I'm not sure about the exact time.