Open liudonghua123 opened 10 months ago
Hey @liudonghua123 could you elaborate more on your use case? There may be alternatives to building node.js for Wasm.
Some context: For purely JS applications there are engines like Javy
We have not considered node.js at this stage. Most of our work here is focused on wasi-sdk so far and a some of the default functionality in node.js that you rely on may be missing even if we manage to build a stripped version of it that runs on WASI.
Hey @liudonghua123 could you elaborate more on your use case? There may be alternatives to building node.js for Wasm.
Some context: For purely JS applications there are engines like Javy
We have not considered node.js at this stage. Most of our work here is focused on wasi-sdk so far and a some of the default functionality in node.js that you rely on may be missing even if we manage to build a stripped version of it that runs on WASI.
Hi, I am writing an app which shows some tutorials or exanples for python, php and nodejs and so on. And I want to use pure web stack without a server, without install and configure python, php and nodejs environment. For the editor I can use monaco-editor, for the python I can use pyodide and pyright-browser as LSP support. PHP has also webassembly build php-wasm, now I want to found something similar for nodejs.
I also tried to build nodejs with emsdk, but it failed with 'sys/epoll.h' file not found
when build deps/uv
, it similar to this issue which seems difficult to solve.
If all the mentioned goals resolved, then I can use tauri to pack it and make the app to support all the majority platforms which include windows, macos, linus, web and android/ios mobile (tauri 2.0 will support mobile platform and will arrive soon).
See also:
In short, I don't believe we can do what you seem to want in any near future, however I see an option for you to pivot your approach. Let me know if any of these comments make sense, as I may be misunderstanding.
Hi, I am writing an app which shows some tutorials or exanples for python, php and nodejs and so on. And I want to use pure web stack without a server, without install and configure python, php and nodejs environment. For the editor I can use monaco-editor, for the python I can use pyodide and pyright-browser as LSP support. PHP has also webassembly build php-wasm, now I want to found something similar for nodejs.
All runtime builds that we do here are targeting WASI, i.e. server-side Wasm. The reason is two-fold - there are already browser-based builds for most major languages, and we believe in WASI as the system platform that will make Wasm apps truly portable with time. Even if we added a node.js one, it would still be WASI based, Which means you would need to embed a WASI implementation in the frontend browser App, which you build.
If all the mentioned goals resolved, then I can use tauri to pack it and make the app to support all the majority platforms which include windows, macos, linus, web and android/ios mobile (tauri 2.0 will support mobile platform and will arrive soon).
First time I hear about Tauri from you (and it looks like a great next gen step from Electron)! If you're only targeting desktop/mobile portability (not a browser one), you could embed a WASI-based Wasm runtime as a Rust plugin to the backend and call it via Tauri commands from the JS frontent. True, this will lose the browser level portability of your frontend code, but IMHO will give you better future stability - as Tauri uses native browser engines (from what I see on their page) you will rely on the Wasm support of those if you keep to browser portability. If you choose the server/backend - side portability instead you will have it all under your own control - in the Rust code of your backend plugin.
@assambar Thanks for your detailed explanation and suggestions. Maybe I need to re-think my ideas.
Even if we added a node.js one, it would still be WASI based
Provide a WASI based node.js would also be nice feature, I am look forward to use it. Is there any roadmap to support WASI based node.js?
I see there is uvwasi in the node.js source code already, maybe it can be build with wasi-sdk.
Is your feature request related to a problem? Please describe.
Hi, build node as wasm would be awesome. Some other solutions like webcontainer and codesandbox already maybe have done it.
But they are not shared nor could use self-hosted locally or offline.
Describe the solution you'd like
Maybe this could be done using https://github.com/WebAssembly/wasi-sdk or https://github.com/emscripten-core/emsdk.
Describe alternatives you've considered
N.A.
Additional context
N.A.