Live data from Hacker News

WebContainers: Run Node.js natively in the browser

blog.stackblitz.com

61–70 of 238 posts

Re: WebContainers: Run Node.js natively in the browser

#61
I used to teach web development and was always frustrated with just how much effort went into setting up a machine. It would be really nice if a developer could just include a script tag in their project that setup a TypeScript compiler inside service worker. I managed to get the basics down, even fixing relative import statements. Requests like localhost:3000/main.tsx would compile and cache on the fly.

There were a few native file system issues I encountered that this would be perfect for!

Re: WebContainers: Run Node.js natively in the browser

#62

Earlier quoted context omitted.

This is going full inception mode. Nodejs is compiled to wasm (like assembly for your browser), and then loaded inside the browser, which can then run javascript. So a full JS engine is loaded, completely separate from the built-in one.

yeah that's what I gathered: javascript already runs on the browser, then we got node.js because people liked javascript and wanted to run it natively, and then finally we got this which allows us to run node.js on the browser again? it looks to me like we've gone full circle with extra overhead :D but I guess people have reasons to run node.js on the browser and not javascript so idk

I guess the idea is to access some Apis that are not present in the browser, like fs. This was mentioned in a question to StackBlitzs CEO, but he seems to be an AI that just pastes the same text over and over again.

Re: WebContainers: Run Node.js natively in the browser

#63
This is super cool! I think pairing this with the upcoming native support for modules and a CDN like skypack could lead to a truly powerful browser development experience.

No bundlers and a full IDE? Maybe this could even mean that there's a chance for a some of the 'just fiddle with the page' experience to come back to the web! (/rainbows and unicorns)

Re: WebContainers: Run Node.js natively in the browser

#64

Yawn. It isn't open source. It has a name, WebContainers, that implies it's based on the web, but it's designed around Node.js which isn't built on browser technologies as much as something like Skypack or Deno. It also seems like it's going to be a memory, disk, and CPU hog, and that it's going to be pretty complex. I like where Skypack is headed and this seems like the opposite direction. It's pretty cool but it se…

> I like where Skypack is headed and this seems like the opposite direction.

I did a quick google search because I had never heard of Skypack.

Skypack seems to be a far cry away from what WebContainers is claiming to do. Like, they're completely different products. I guess I don't understand why you're even comparing the two.

Re: WebContainers: Run Node.js natively in the browser

#65

As far as I understand JS code is being run natively in the browser. Node has been hooked to the native engine, so V8 is not involved. At LeaningTech we have since several months been able to run nodejs, but also python and ruby using our Wasm based x86 VM (CheerpX), the demo is available here: https://repl.leaningtech.com/?nodejs With our solution the full Linux x86 binary of nodejs is running including the whole of…

> We are working on CheerpX, but it’s not yet available generally. If you are curious and want to know more, stay tuned, or get in touch!

How close is CheerpX to getting (for example) an app that uses a PyTorch model running in the browser? :)

Re: WebContainers: Run Node.js natively in the browser

#67
post #53

Earlier quoted context omitted.

If their base is node, that implies we could start to see many electron.js app being ported to the browser

ELI5... why would you want to run an Electon app in the browser? Isn't that just a website at that point? EDIT: Upon closer inspection, it looks like this is an online IDE meant to mimic a desktop environment. I don't know if there's any demand for that, but sure, why not. I'm sure someone will come up w/ a reason to run WebAssembly in a jQuery plugin, too.

Backwards compatibility with existing Electron apps I guess? Otherwise yeah, a native PWA would be better.

Re: WebContainers: Run Node.js natively in the browser

#68
post #65

As far as I understand JS code is being run natively in the browser. Node has been hooked to the native engine, so V8 is not involved. At LeaningTech we have since several months been able to run nodejs, but also python and ruby using our Wasm based x86 VM (CheerpX), the demo is available here: https://repl.leaningtech.com/?nodejs With our solution the full Linux x86 binary of nodejs is running including the whole of…

> We are working on CheerpX, but it’s not yet available generally. If you are curious and want to know more, stay tuned, or get in touch! How close is CheerpX to getting (for example) an app that uses a PyTorch model running in the browser? :)

Not an expert on PyTorch in particular, the python + native (if any) components would work right now. If GPU acceleration is required some way to bridge into WebGL or (much better) WebGPU would need to be engineered, certainly doable but not existing right now.
Post reply on HN