4 ms·
The announcement says that you can't use extensions that use node. I thought they might use WebContainers from StackBlitz to run node in webassembly with this?
by adamddev1 3y ago
The announcement says that you can't use extensions that use node. I thought they might use WebContainers from StackBlitz to run node in webassembly with this?
https://blog.stackblitz.com/posts/webcontainer-api-is-here/ https://blog.stackblitz.com/posts/webcontainer-api-is-here/
Or could use one for the tiny linux VMs running in WebAssembly, that could run anything...
- ogoffart 3y agoThat's not as trivial because extension that uses node also use the fact that this is the same node instance that runs vscode itself and use vscode API to do "things". Other things it does is accessing the file system or network which may anyway not work even in a WebContainer. It is pretty easy to port an extension to be able to run as a web extension as well. This is documented there: https://code.visualstudio.com/api/extension-guides/web-extensions https://code.visualstudio.com/api/extension-guides/web-exten... I've done that for my extension. My extension uses a language server through the Language Server Protocol (LSP). In order to make it work as a web extension, I had to compile the language server (written in Rust) to webassembly, and also hack a way to query "import" files via vscode api instead of file system access.
- CompuIves 3y agoThe editor on CodeSandbox runs web VSCode, and in that version we emulate Node.js in the browser to run local extensions.
- lioeters 3y agoI'm curious about the technical details. Could you elaborate on how CodeSandbox runs Node.js in the browser? Does it use a Linux VM like Alpine compiled to WASM?
- lioeters 3y agoOh I think I found the answer. > Nodebox is a runtime for executing Node.js modules in the browser. https://github.com/codesandbox/nodebox-runtime https://github.com/codesandbox/nodebox-runtime https://sandpack.codesandbox.io/docs/advanced-usage/nodebox https://sandpack.codesandbox.io/docs/advanced-usage/nodebox