Announcing Native Language Support in WebContainers
Today, we are thrilled to announce the full-scale integration of WASI ( WebAssembly System Interface ) into WebContainers . This marks a milestone that amplifies what you can do with your browser. It’s a whole new paradigm for web development, and allows to run a large spectrum of native applications without thinking about multiple different architectures.
What is WASI?
WebAssemblyserves as a compilation target, where native code, for example, Rust , C++ , or Golang , is compiled into WebAssembly . Initially, it was created to run native languages such as C++ or Rust on the web. However, it has now expanded its scope of application. WebAssembly supports a broad range of programming languages, and it is no longer confined to just web browsers.
This expands what WebAssemblycan do and allows us to build applications in any language that compiles to WebAssembly and run them in any place where a runtime is available, including WebContainers !
Why is this significant?
If you’re a developer, WASI’s potential impacts you in a number of groundbreaking ways:
Speed & Security: You get the best of both worlds. Applications that run at near-native speed while maintaining a secure, sandboxed environment.
Portability: Compile once, run everywhere! Compile native code to WebAssemblyand run it on the web or elsewhere. You don’t have to worry about the quirks of running your code on different platforms regardless of the underlying operating system.
What does this allow me to do that I couldn’t do before?
With the integration of WASIinto WebConatiners , there’s now a wasm command you can use from the terminal to execute a WebAssembly or WASI -compiled module. This means you can compile your native code to WASI , upload it to your project, and simply run it via the new wasm command:
If you want to learn more about how you can compile your code to WASI, check out this WASI tutorial from the Bytecode Alliance .
We’re also thrilled to give you a sneak peak into the potential of WebContainers. As a demonstration of what’s possible, we’re introducing experimental support of Python within WebContainers 🎉 🤯 🙌 . This is especially significant when you consider that Python , the third most frequently used programming language, has traditionally been absent from the browser’s native environment. Requiring external servers for execution, Python ’s capabilities were often segmented, resulting in disconnected development experiences. But no more. With WASI ’s integration into WebContainers , the realms of the server and the browser merge further, paving the way for a new era of in-browser development. Importantly, as WASI continues to evolve and expand its feature set, it will directly influence the capabilities of Python within WebContainers . Please note, this Python integration is very experimental which means that currently it’s limited to the core features of the Python language. As of now, we haven’t yet rolled out support for pip , Python ’s defacto package manager, which means you won’t be able to install additional Python packages just yet. You can write, edit, and execute Python scripts that rely on built-in Python modules and functionalities, however, more complex projects that depend on external libraries will have to wait a bit longer.
We also extended the capabilities of our shell. We have added support for jq , a native command-line JSON-processor allowing you to easily slice, filter, map, and transform structured data. You can use this from the shell in any project.
Our plan is to add more tools like this in the future!
There are many toolchains and ecosystems that have recognized the power of WebAssemblyand WASI . A prime example is WordPress . Not only has WordPress the majority of the market share among other CMS with a whopping 64% , but it also powers an astonishing 43% of all websites on the internet. You can run the entire WordPress stack inside WebContainers . This unlocks full WordPress plugin development, all within your browser. We’re excited to work more with the WordPress team and other ecosystems as we continue to push the boundaries of what’s possible.
How can I try it out myself?
You can try this out today! Visit stackblitz.com, click on the newly introduced “ Native Languages ” tab — that’s still in alpha — and start hacking away.
As exciting as all these developments are, we’re just getting started. WASIitself is still in the process of being standardized, and as it matures, it promises to unlock even more capabilities within WebContainers . As we look to the horizon, the path charted by the WASI roadmap will be instrumental in guiding us. There are a handful of very exciting new features being developed, including WebAssembly Threads or WebAssembly Garbage Collection.
That said, we’re committed to staying at the cutting edge! Our ambition is to add experimental support for other popular languages as well. In particular, we want to add experimental support for Rubyand PHP.
The future is bright, and we can’t wait to explore it with you. Stay tuned for more updates as we continue to push the boundaries of what’s possible, empowering developers to create, innovate, and build delightful experiences like never before.