Node: WASI as a build platform

Created on 29 Aug 2020  路  7Comments  路  Source: nodejs/node

I think it is possible because current macOS support is via LLVM toolchain that could target webassembly and WASI (but I have no idea about the process).

Benefits:

  • Custom hardware that can run webassembly will be able to use nodejs without official support (mobiles, embedded devices, ...)
  • Use nodejs (and couple of server side only packages) in browser.
  • Use in future wasm-container
  • And almost any benefit wasm and WASI have for the server side
blocked build feature request

Most helpful comment

To paraphrase Gus: while theoretically possible, a massive amount of work needs to happen in our dependencies first before Node.js itself can even consider WASI as a target.

@HKalbasi Are you volunteering to work on this? I'd start with V8 and libuv.

All 7 comments

This is theoretically possible but will most likely require a large amount of work. One thing to note is that V8 would not be able to JIT in wasm, unless wasm gained new functionality, so it would be pretty slow.

Good point. But in case of "nothing" vs "very slow" I think "very slow" is better. Python does not have JIT and people are happy (at least tolerate) with that.
And this can be the starting point. Things can happen over time. Wasm community (Which has a lot in common with js community) maybe solve this in future.

To paraphrase Gus: while theoretically possible, a massive amount of work needs to happen in our dependencies first before Node.js itself can even consider WASI as a target.

@HKalbasi Are you volunteering to work on this? I'd start with V8 and libuv.

I am volunteer but my current knowledge is almost nothing. As a start, I will try to contact the developers.

To save you a bit of trouble, I'm a libuv maintainer and while I'll certainly review pull requests adding WASI support, I have little time or inclination to write it myself. I predict you'll get similar replies from other projects.

So it looks like I have to get my hands dirty. I'm going to see what monster is hiding under the bed.

I'm going to close this for now because it's not actionable. Can reopen when it is.

Was this page helpful?
0 / 5 - 0 ratings