News for hackers. Stuff that matters.
Re:WebContainers: Run Node.js natively in the browser by ericmsimons on Thursday May 20, 2021 @01:11PM (#27223934)
Hi all- CEO of StackBlitz/author of this blog post here. Happy to answer any questions! (Also, thanks for posting this bpierre!)
Re:WebContainers: Run Node.js natively in the browser by Galaco on Thursday May 20, 2021 @09:31PM (#27229554)
> Faster than your local environment. Builds complete up to 20% faster and package installs complete >= 5x faster than yarn/npm.

Above is a quote from the post. I feel like this is a stupid question, but how can running yarn/npm in a browser on my machine be faster than running yarn/npm on my machine? Particularly when each page load runs a fresh npm/yarn install?

Nonetheless, this is a incredible piece of software that i'll be following closely

Re:WebContainers: Run Node.js natively in the browser by giorgioz on Saturday May 22, 2021 @03:40AM (#27244423)
I've also asked myself this question. I think the comparison is not with a local environment but rather with running node/yarn/npm on a remote virtual machine/ci. This is my hypothesis, I have no proof that's what they meant.
Re:WebContainers: Run Node.js natively in the browser by dspillett on Monday May 24, 2021 @09:58AM (#27264417)
I'm wondering if there is more happening in-memory, even if the project files and modules themselves are on-disk (accessed via FileSystemAPI) the vscode/node/other bits including temporary files may be held in RAM once initially loaded and never swapped out.

If that is the reason, then if your machine becomes memory constrained, the performance will drop through the floor quicker than with full-local installs.

It could be a mix of this and your suggestion (lower network latency related bottlenecks than experienced with non-local deployment).

Re:WebContainers: Run Node.js natively in the browser by altano on Thursday May 20, 2021 @11:08PM (#27230056)
I was wondering the same thing
Re:WebContainers: Run Node.js natively in the browser by grassthehopper on Friday May 21, 2021 @10:06AM (#27234122)
I'm also curious about this
Re:WebContainers: Run Node.js natively in the browser by simonw on Thursday May 20, 2021 @01:14PM (#27223971)
Is this all open source?

I'm fascinated in learning more about how you run a web server with this - the article says "WebContainers include a virtualized TCP network stack that's mapped to your browser's ServiceWorker API" but I'd love to understand a bit more about how that works.

Since this is all done with WebAssembly are you planning on targeting other stacks such as Python? The amount of time I lose helping other people getting their Python development environments to work remains horrifying.

Re:WebContainers: Run Node.js natively in the browser by ericmsimons on Thursday May 20, 2021 @02:29PM (#27225150)
We'll be open sourcing core parts of WebContainer as we move towards GA. 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 stephenbuilds on Thursday May 20, 2021 @02:35PM (#27225232)
First, congratulations! This is an astonishing advancement.

I found this on the GH repo: "Is this open source? Today no, but the API will be open source to developers at GA."

I'm confused by what "the API" is, exactly. Is WebContainers a technology you plan to make available for others to use node, in the browser, in their own apps?

Re:WebContainers: Run Node.js natively in the browser by nailer on Thursday May 20, 2021 @04:21PM (#27226671)
> "Is this open source? Today no, but the API will be open source to developers at GA."

If they make it Open Source, Microsoft will add it to VScode and eat their lunch.

If they don't, developers might be afraid of lock in.

Best exit for them is to just grow users and not make a decision either way until they get acquired by Github (aka Microsoft) and folded into VScode.

Re:WebContainers: Run Node.js natively in the browser by crazypython on Thursday May 20, 2021 @09:15PM (#27229454)
> If they make it Open Source, Microsoft will add it to VScode and eat their lunch.

Put the code under the GPL so no one can use it to build proprietary software. Visual Studio Code contains proprietary components, so this would prevent that.

Re:WebContainers: Run Node.js natively in the browser by apignotti on Thursday May 20, 2021 @02:50PM (#27225444)
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 by yuri91 on Thursday May 20, 2021 @02:19PM (#27225001)
Is node/v8 compiled to Wasm entirely, or are you using the browser's JS engine with polyfills for node's APIs? Or something in between?
Re:WebContainers: Run Node.js natively in the browser by worik on Thursday May 20, 2021 @05:02PM (#27227204)
Why do this at all?

With all the security and design problems of Node.js, when there are actually secure and reliable ways (harder ways, yes. Security and reliability are hard) to do all of this. Why?

Re:WebContainers: Run Node.js natively in the browser by supermatt on Thursday May 20, 2021 @09:39PM (#27229599)
You mention being able to use the debugger. How do I do this? The docs are very poor.

I dont see any way to set breakpoints. When i use a debugger statement and open inspector it breaks on transpiled/packaged code (its different to the actual file). This is a deal breaker for me at present. Am I doing something wrong?

(Using the http server template)

Re:WebContainers: Run Node.js natively in the browser by drew-y on Thursday May 20, 2021 @04:48PM (#27227032)
Can you expand on the capabilities of the terminal? What sort of operations can be done from the terminal?

It looks like the shell is JSH. Is this an in house shell? Is there any more information on it?

Re:WebContainers: Run Node.js natively in the browser by skybrian on Thursday May 20, 2021 @01:43PM (#27224432)
Could you point us to an introduction to how operating system concepts get mapped to browser concepts?

It sounds like each native binary gets compiled to a WebAssembly binary, but how do they communicate? How are the network and file system implemented? Are parts of the file system persistent? How does a system call work?

Re:WebContainers: Run Node.js natively in the browser by ericmsimons on Thursday May 20, 2021 @02:29PM (#27225155)
Great questions- 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 miohtama on Thursday May 20, 2021 @06:54PM (#27228462)
How much of this is JavaScript specific and how much could be expanded to “any” programming language?
Re:WebContainers: Run Node.js natively in the browser by Scottttttt on Friday May 21, 2021 @03:56AM (#27231537)
This pretty cool stuff. I am wondering about another use case for this type of thing.

We have a CLI tool built with node.js, could we build one of these containers with with the CLI tool setup and expose just a terminal with access to the local file system?

Re:WebContainers: Run Node.js natively in the browser by bpierre on Thursday May 20, 2021 @01:23PM (#27224119)
You’re welcome :)

Any plan to work towards supporting Firefox & other browsers?

Re:WebContainers: Run Node.js natively in the browser by ob1gman on Friday May 21, 2021 @10:20AM (#27234284)
Yes definitely! Firefox compatibility is close to done and will ship soon. Waiting on Safari to ship some additional features. They don’t share timelines so it’s unclear at this point.
Re:WebContainers: Run Node.js natively in the browser by bpierre on Saturday May 22, 2021 @04:27PM (#27249981)
That’s great to hear! Looking forward to it.
Re:WebContainers: Run Node.js natively in the browser by imvetri on Friday May 21, 2021 @01:54AM (#27230935)
Hi, Can you share how it is working under the hood ?
Re:WebContainers: Run Node.js natively in the browser by bouh on Thursday May 20, 2021 @04:29PM (#27226777)
hey very nice work !

do you think that a docker.js running containers in the browser is something that could become a reality soon if we follow you line of work ?

Re:WebContainers: Run Node.js natively in the browser by waheoo on Thursday May 20, 2021 @01:28PM (#27224198)
That isn't a blog post. That's an ad.

Can you link to the blog post where you actually discuss literally any of the technical stack in any depth further than one sentence of wow more pizzaz much fast.