Open Seirdy opened 1 year ago
This is a good idea, and the concept of transpiling the WebAssembly is especially great as it reduces any maintenance burden in having both implementations. I haven't experimented with any transpilers, but Pagefind's WebAssembly is intentionally simple and small, so if anything would work through that process it would be this.
I'm unlikely to have the time to tackle this in the medium-term, but I'm open to someone contributing this as a feature. Ping me in this thread if anybody wants to spitball what might be needed for them to implement this 🙂
polywasm works fine with pagefind. tl;dr
self.WebAssembly = self.WebAssembly || (await import("https://unpkg.com/polywasm@0.1.4/index.min.js")).WebAssembly
I just ran into this issue with chromite and vanadium. I posted about it here but will remove it now.
WebAssembly is not available when browsers disable JIT compilation:
I'm sure more examples exist. Some of these, such as iOS Lockdown and Edge's Enhanced Security, are relatively recent developments, so it's not unreasonable to assume that the popularity of JIT-toggling will increase with time.
A good approach would be to have an asm.js-based fallback. That's the approach used by CryptPad, and it has good results. Some polyfills allow transpiling WebAssembly to asm.js with usable performance.