Live data from Hacker News

WebContainers: Run Node.js natively in the browser

blog.stackblitz.com

51–60 of 238 posts

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

#51

totally lost newbie here: but what is the difference between running javascript on the browser and running node.js on the browser?

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

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

#52
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 V8 and its JIT engine. Of course fully client side.

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

#54

Hi all- CEO of StackBlitz/author of this blog post here. Happy to answer any questions! (Also, thanks for posting this bpierre!)

Hi, CTO of LeaningTech here. Congratulations for the highly polished demo. I think you might find interesting this one we did months ago: https://repl.leaningtech.com/?nodejs

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

#55
post #53

I think very few people will realize the systemic effects that a demo like this entails. Very, very good work StackBlitz team!

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.

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

#56

I think very few people will realize the systemic effects that a demo like this entails. Very, very good work StackBlitz team!

Funny you say that. I'm usually really skeptical of the next big thing but I felt differently about this, just can't put my finger on it.

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

#57
post #39

totally lost newbie here: but what is the difference between running javascript on the browser and running node.js on the browser?

basically node exposes all these other APIs like reading a file from disk. Browser also has APIs like detecting when the page is fully loaded that wouldn't be available on Node. What JavaScript syntax is supported can also vary between Node and browsers.

WASM cannot magically load from disk, there is browser protection, right?

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

#58

Does this mean we can use sqlite natively on the browser now?

Yes. One of our engineers has gotten sqlite to run natively in WebContainer. Will be releasing as OSS in the next few weeks!

That's pure orgasm. Thank you for this!

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

#59
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.

I guess that running in the browser it doesn't need to be installed on the machine.

Or a desktop-only Electron App would be usable from a mobile phone browser etc.

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

#60
post #12

Earlier quoted context omitted.

Yep- if you go to https://stackblitz.com you can start a Next.js, GraphQL, etc dev environment in one click.

... in chrome.

I'm not sure what the complaint is here. Isn't it something like 90% of the browser market is chromium-based, now that edge is on the bandwagon?

Supporting chrome/chromium doesn't seem like a bad place to start with a prototype with that kind of potential adoption.

Post reply on HN