mirror of
https://github.com/neovim/neovim.git
synced 2026-08-17 17:04:47 -05:00
docs: WebAssembly build instructions #40541
Adds build instructions for the experimental WASM (`wasm32-emscripten`) target under the Cross-compiling section of `BUILD.md`.
This commit is contained in:
@@ -593,3 +593,23 @@ Also relevant for webassembly (WASM) build.
|
||||
cross-compiling or "-Dhost=" (empty string) to assume that target binaries
|
||||
can run on the host during the build process (e.g. if target is x86 on a
|
||||
x86_64 system, or if emulation set up with binfmt or similar)
|
||||
|
||||
### WebAssembly (experimental)
|
||||
|
||||
Neovim can be cross-compiled to WebAssembly using the `wasm32-emscripten` target.
|
||||
|
||||
- Requires the [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html) (`emsdk`).
|
||||
- After installing and activating it, pass its sysroot to `-Demscripten-sysroot`, e.g. `$EMSDK/upstream/emscripten/cache/sysroot`.
|
||||
|
||||
To build the WebAssembly target:
|
||||
|
||||
```bash
|
||||
zig build nvim_bin \
|
||||
-Dtarget=wasm32-emscripten \
|
||||
-Demscripten-sysroot=$EMSDK/upstream/emscripten/cache/sysroot
|
||||
```
|
||||
|
||||
This currently produces:
|
||||
|
||||
- `nvim.wasm`, the WebAssembly module.
|
||||
- `nvim.js`, the JavaScript loader generated by Emscripten.
|
||||
|
||||
Reference in New Issue
Block a user