Live data from Hacker News

WebContainers: Run Node.js natively in the browser

blog.stackblitz.com

141–150 of 238 posts

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

#141
post #71

Wow, the PWA is really impressive. Honestly it's starting to get hard to tell the difference between this and Electron-based editors like VS Code. I'm really excited for integration with the File System Access API; that's the final puzzle piece I'd need to use something like this for serious work.

> Honestly it's starting to get hard to tell the difference between this and Electron-based editors like VS Code

Since Electron is just chromium, I'm not sure why you would expect a difference in the first place? The differences that previously existed between Electron & Web hasn't changed - Electron's only real purpose was to basically turn off the browser permission model & let the "web app" do whatever it wants. That's still true with WebContainers, it still has its hands & features tied to whatever Chrome & browsers in general are comfortable letting websites ask permission to do.

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

#142

Earlier quoted context omitted.

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.

> I guess the idea is to access some Apis that are not present in the browser, like fs.

That's why electron exists. But this can't do that, it's still limited by the APIs that are present in the browser. It's seemingly just full-overhead for... some... reason?

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

#143
post #74

Earlier quoted context omitted.

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

It can't access the file system, but it could implement an API that emulates a file system inside the browser sandbox. Presumably that's what they're doing here.

But you can do that same API emulation in regular browser JavaScript, too. What's the WASM intermediate buying here?

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

#144

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…

I taught web development at a university last summer with CodeSandbox remotely.

Worked like a charm.

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

#145
post #110

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…

Yes web developing is so hard... sudo apt install apache2 php libapache2-mod-php; vim /var/www/html/index.php

I see you haven't done anything in 10 years

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

#146
post #91

Earlier quoted context omitted.

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?

> "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.

> 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

#148

What about this is "native"? The page says it is "running natively" but also says "All code execution happens inside the browser's security sandbox". Is wasm in a browser somehow considered native now?

WASM can be compiled to native code.

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

#149

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

> 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

#150
post #74

Earlier quoted context omitted.

It can't access the file system, but it could implement an API that emulates a file system inside the browser sandbox. Presumably that's what they're doing here.

But you can do that same API emulation in regular browser JavaScript, too. What's the WASM intermediate buying here?

I think it is more complicated to emulate those api in normal browser environment compared to emulating some OS api for running node.js.
Post reply on HN