Webassembly: Why so closely tide to Node?


I have been learning Rust in my spare time for a couple of years, and recently have been exploring webassembly to tie in Rust with PWAs, another technology I have been recently exploring.

tl;dr Rust is a carefully designed marvel of modern technology that builds on the lessons of the past. Node.js is not and does not. Why tie Webassembly so closely to Node.js?

I recently walked through the tutorial for which I installed the Node.js mess into a VM for that purpose. The resulting www/ heirachy had more than 7,000 files in it, all in my document root. The system was periodically polling my server for some unknown reason. I really do not trust it. AFAICT there is no straightforward path to serving with my favorite webserver. The turtorial leaves me high and dry in Node hell.

I have found this documentation and this code which looks like it will meet my needs. Thank you (again) to Rusticans beating a path for me, I really appreciate it.

I am interested in why the choice was made.


I think it's simply because many people involved in WASM have come from the Node.js land.

Node is much much more popular than Rust, so for most people coming to WASM it's likely easier to use a Node server than to also learn how to build a Rust server.


At this stage in WebAssembly's life, many folks believe that wasm will mostly be used to augment existing JavaScript applications, in the same way that say, a C extension would be used to augment a Ruby app. It is also significantly easier to adopt something in an incremental way.

Therefore, smoothing out these integrations and showing folks how to use them is more likely to increase adoption.


Silly me.

And much much worse. But I get your point.
Reminds me of 1995, when Windows95 came out and I was happy writing my thesis and doing my research on a Linux box - "The OS Linux is so bad they have to give it away" said the Y2K manager of our biggest Telecoms supplier a couple of years later.
Sigh. Node.js/NPM and their ilk are proof that it is easier to speak than listen, easier to write than read.
For giggles, when I was asking/writing this question I looked NPM up on wikipedia.
From https://en.wikipedia.org/wiki/Npm_\(software\)#History
npm is written entirely in JavaScript and was developed by Isaac Z. Schlueter as a result of having "seen module packaging done terribly"

The answer to the underlying question: Rust/WASM is in no way tied to node. It's just that the simplest way to build a wasm webapp is with node tooling, and will be for some time.

There are wonderful things being done with Rust/WASM without any JavaScript at all, such as watt.

Node, for any and all of its flaws, is very easy to use, and is where the web development community is currently. Rust on the web won't get adoption by boiling the ocean and rejecting node, but rather by integrating with the ecosystem that people use in practice.


Yes. Thank you.
Obvious really, I posted out of frustration.

FWIW I do think the tutorials should steer clear of Node. The game-of-life tutorial leads a person to the conclusion that Node is essential. It is periphery. But the --target web is deprecated in those documents. I do not think it is deprecated intentionally, but that is how it looks.
But who am I to grizzle? Not a person writing a replacement tutorial yet. (Hmmm....)
I am actually a person extremely grateful for all the hard work other people are doing for my benefit. Loving it, Node.js and all....


I ran into a similar problem finding simple documentation for doing simple things with WebAssembly. For my needs, I just needed a simple module to push queries into and get results back. I didn't want any dynamic server-side code at all. And since it would be running in a web worker, it didn't even need any sort of complex JavaScript bridging like DOM manipulation.

In the end, the very minimalist Hello, Rust tutorials and demos were all that I needed. Though the site deems itself outdated, I found it quite helpful for learning how the two sides fit together in a straightforward way.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.