WebContainer API
21–30 of 54 posts
Re: WebContainer API
#22Can anyone translate this from marketing speak to developer speak? I’m genuinely not sure what this is. Is this like… WASM docker in the browser or what?
Re: WebContainer API
#23Can anyone translate this from marketing speak to developer speak? I’m genuinely not sure what this is. Is this like… WASM docker in the browser or what?
Re: WebContainer API
#24Can anyone translate this from marketing speak to developer speak? I’m genuinely not sure what this is. Is this like… WASM docker in the browser or what?
I’m also equally confused.
What WebContainers doesn't do is provide container tech. WebAssembly is similar to a Docker container, so much so that Docker now supports WebAssembly. WebContainers also uses a subdomain and the browser's security model. In fact the browser is the main thing that limits what stuff inside the WebContainer can do in WebAssembly. WebContainer runs whatever JavaScript the WebAssembly code spits out. Like DotCloud one of the great things about WebAssembly is that it can run a wider variety of code performantly than a JavaScript engine can - not just code that can compile to JS but anything that can be compiled to its bytecode. This is what WebContainer takes advantage of - not the sandboxing of a WebContainer, which is also excellent but isn't the right fit for a code sandbox like jsbin/CodePen/CodeSandbox/etc, which needs to be able to run whatever can be run in a browser tab.
What WebContainers does is use some hacks to sort of run node apps in the browser, so instead of using something like the browser version of rollup, you can use something like vite. You can also see the console output that vite would provide.
When vite installs esbuild I think it probably specifies the non-WASM esbuild. So it's likely running patched vite and running WASM esbuild.
It uses a fake npm and yarn and shows npm and yarn in the output. This explained in this FAQ under "Do you support yarn or only npm?": https://github.com/stackblitz/webcontainer-core#faqs
It has an iframe sandbox with same-origin which means in order for it to be contained, you need a subdomain. This is something other major sandboxes do like jsbin and CodeSandbox. This is why IMO it doesn't provide container tech.
That's lucky, because custom container tech on the web winds up being like Google Caja which was a marvelous accomplishment but not nearly as robust as Docker, MicroVMs, WASM, or the browser security model (, CSPs, and more): https://en.wikipedia.org/wiki/Caja_project https://devd.me/papers/LeastPrivileges.pdf
Re: WebContainer API
#25Re: WebContainer API
#26This looks really cool (I love anything with a filesystem API), but I'm unclear on the role of hosted proxies in this setup. Also, the licensing costs aren't clear. "WebContainers rely on hosted proxies and server-side acceleration to enable truly instant development environments. By obtaining a WebContainer API license, your business can gain access to higher API rate limits, uptime reliability, and a range of benef…
That's bizarre how the major emphasis is on running things client-side instead of on a hosted VM, but then it still requires a live paid service
You could offer self hosting of those and no licensing for commercial products, but you then wouldn't have a financial strategy to develop the technology in the first place. Not quite as much at least.
A big draw is you don't have to give access to a 3rd party all of your code if the technology is client side. Since the server side is just managing/proxying 3rd party dependencies.
All that being said, I'd appreciate a more forthcoming statement of this, as it is confusing, bordering on misleading.
I love the technology though and I do have plans to use it.
Re: WebContainer API
#27Re: WebContainer API
#28Earlier quoted context omitted.
I’m also equally confused.
It's an irritating name, like PlanetScale. It both makes it sound more official (it's not official at all) and more high-tech than it is. What WebContainers doesn't do is provide container tech. WebAssembly is similar to a Docker container, so much so that Docker now supports WebAssembly. WebContainers also uses a subdomain and the browser's security model. In fact the browser is the main thing that limits what stuff…