Live data from Hacker News

WebContainers: Run Node.js natively in the browser

blog.stackblitz.com

171–180 of 238 posts

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

#171

Earlier quoted context omitted.

That's a really good point. What we wanted all along was the JVM with a DOM API. We started with Java. It didn't gain any traction for browser scripting. They took "Java" out and called it JavaScript. Now we take the "script" out and call it WebAssembly. If someone in 1995 made Java a DOM-editing thing instead of an applet thing, we could have saved 25 years of running around in circles :) (Going back even further, w…

What I’ve always wanted is scheme in the browser.

There was a fork in the road of history, where that could have been the future we live in..

> In 1995, Netscape hired Brendan Eich with the promise of letting him implement Scheme (a Lisp dialect) in the browser.

How JavaScript Was Created - http://speakingjs.com/es5/ch04.html

---

> Whether that language should be Scheme was an open question, but Scheme was the bait I went for in joining Netscape. Previously, at SGI, Nick Thompson had turned me on to SICP.

> ..The diktat from upper engineering management was that the language must “look like Java”. That ruled out Perl, Python, and Tcl, along with Scheme.

https://brendaneich.com/2008/04/popularity/

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

#172

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 wonder if that is the ideal path though, I was an instructor for a few subjects in my university and sometimes the biggest detractor for students was the lack of familiarity with the tool set used by the language, for example, people sometimes did not know how to freeze their dependencies and use python virtual environments when working with python projects, that lead to problems in collaboration, handing students…

It’s even funnier when those same devs who struggle with packaging and distribution in their best language go on to work at Fortune 500 companies and require constant devops assistance to actually make what they wrote work in even a test env. “But it works on my laptop!”

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

#173
post #110

Earlier quoted context omitted.

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

PHP is actually pretty great these days, you should have a look at what modern PHP has become if you’ve been out of the loop for a while. Have a look at https://phptherightway.com/ if you’re interested.

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

#174

Earlier quoted context omitted.

I wonder if that is the ideal path though, I was an instructor for a few subjects in my university and sometimes the biggest detractor for students was the lack of familiarity with the tool set used by the language, for example, people sometimes did not know how to freeze their dependencies and use python virtual environments when working with python projects, that lead to problems in collaboration, handing students…

It’s even funnier when those same devs who struggle with packaging and distribution in their best language go on to work at Fortune 500 companies and require constant devops assistance to actually make what they wrote work in even a test env. “But it works on my laptop!”

“Yes, but we are not shipping your laptop!”

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

#175

To demonstrate the potential this needs a demo of a "middle-tier" service implemented in NodeJS. The service needs to talk to a MySQL database, and expose a Rest API to the web application. If that works that means many intranet applications can be server-less. Both the JavaScript app and the "middle-tier" runs in the browser, and the middle-tier talks to MySQL server which is also on the intranet. All you need is a…

If the middle-tier and the app are both written in JavaScript, and you're developing them both simultaneously in the browser, does it make sense for them to be communicating via REST any more? Wouldn't it make more sense for the app to send SQL prepared statements to the database (via a tiny standardised wrapper on the server to enforce per-user permissions based on the authenticated session)? It probably depends on…

> via a tiny standardised wrapper on the server

That defeats the point of not having a server.

The middle-tier should be written in Nodejs because it has drivers for relational databases such as MySQL.

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

#176
post #82

Everyone thought WASM would enable developers to write code in any language they wanted (with type checking and higher performance) and deploy it on the web. JS Developers come in: so we can compile node.js to WASM and run that in the browser?! Yay!! Now we can have backend JS running in the browser alongside browser JS! Jokes aside: this is actually quite interesting, the demo is very impressive (except for the "onl…

Browser Javascript suffers from not producing a single "binary" as its build system output. You do get one bundle, but none of the parts know anything about each other, and it limits the ability to optimize. (It is a lot more like the C preprocessor, rather than a C compiler.) Methods that can't possibly ever be called end up being sent to each user, for no reason other than "well someone could write an eval() that n…

> WebAssembly suffers from there not being a good programming language that compiles to it natively

Is Grain insufficient for some reason?

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

#177

Earlier quoted context omitted.

That's a really good point. What we wanted all along was the JVM with a DOM API. We started with Java. It didn't gain any traction for browser scripting. They took "Java" out and called it JavaScript. Now we take the "script" out and call it WebAssembly. If someone in 1995 made Java a DOM-editing thing instead of an applet thing, we could have saved 25 years of running around in circles :) (Going back even further, w…

What I’ve always wanted is scheme in the browser.

Like this? https://github.com/biwascheme/biwascheme

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

#178

This is a very cool project! I noticed that outgoing http requests don't seem to work (there's no `curl` and after installing a CLI tool I work on via npm (which worked like a charm!), the outgoing API calls it makes were blocked. I assume that's intentional at this stage. Is that changing in the future?

Their repo implies that network requests are subject to the same-origin policy, since it's in a browser after all. If you open up devtools you will probably see complaints along those lines. In short: the endpoints you request need CORS enabled.

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

#179

Earlier quoted context omitted.

> the direction I'd like to see web development move is having a statically typed language that compiles to VM bytecode. Java… you want Java. And so the cycle continues!

That's a really good point. What we wanted all along was the JVM with a DOM API. We started with Java. It didn't gain any traction for browser scripting. They took "Java" out and called it JavaScript. Now we take the "script" out and call it WebAssembly. If someone in 1995 made Java a DOM-editing thing instead of an applet thing, we could have saved 25 years of running around in circles :) (Going back even further, w…

The past was pretty dumb, because it wasn't an open standard based on interoperability.

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

#180

Earlier quoted context omitted.

What I’ve always wanted is scheme in the browser.

There was a fork in the road of history, where that could have been the future we live in.. > In 1995, Netscape hired Brendan Eich with the promise of letting him implement Scheme (a Lisp dialect) in the browser. How JavaScript Was Created - http://speakingjs.com/es5/ch04.html --- > Whether that language should be Scheme was an open question, but Scheme was the bait I went for in joining Netscape. Previously, at SGI,…

Yeah, I know this history well.
Post reply on HN