Re:WebContainers: Run Node.js natively in the browser
by lxe on Thursday May 20, 2021 @01:59PM
(#27224686)
Wow. How? Node.JS needs a "full-blown" OS to compile and run... right? And that's not something you could emulate efficiently using wasm? Right?...?
[ Parent
| on HN ]
Re:WebContainers: Run Node.js natively in the browser
by ericmsimons on Thursday May 20, 2021 @02:32PM
(#27225197)
Great question :) We have some additional technical info in our core WG repo: https://github.com/stackblitz/webcontainer-core
We also did an hour long podcast a few months back that goes into pretty deep detail: https://www.youtube.com/watch?v=5F9qH-ea5Qk
Re:WebContainers: Run Node.js natively in the browser
by brabel on Thursday May 20, 2021 @04:06PM
(#27226460)
node.js, as any other native Linux/Windows/Mac application, talks to the OS via a system API. You can emulate that API using WASM, mapping I/O to browser APIs, which is why they mention network is implemented via service workers, for example. File I/O can be mapped to IndexDB... Threads can also be mapped to service workers, I guess... and so on.
emscripten[1] did this a long time ago for C, which is how a bunch of native applications have already been ported to run on the browser.
webcontainers[2] seem to do a similar thing but focused on exposing the browser API to the native apps in a way that integrates well with the JS environment.
Re:WebContainers: Run Node.js natively in the browser
by bellyfullofbac on Thursday May 20, 2021 @02:25PM
(#27225084)
People have made Linux run on the browser, so... Although I don't think this is what they did here.
Man, the yet another layer they've made between code and the CPU makes me uncomfortable. Imagine finding a bug and going through 20 layers to troubleshoot it.
Also: https://www.theregister.com/2017/03/23/cursor_devours_cpu_cy...