Report unresolved browser WebAssembly host imports through wavec run
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
## Problem
Running a browser-oriented WebAssembly module through `wavec run` can expose a raw Node.js instantiation error when the module imports host functions.
For example, `examples/wasm_module.wave` imports `env.host_add`. Running it for `wasm32-unknown-unknown` currently ends with a message similar to:
```text
LinkError: WebAssembly.instantiate(): Import #0 module="env" function="host_add": function import requires a callable
```
The built-in runner cannot invent application-specific browser host functions, but it should explain the contract cleanly.
## Scope
- Inspect WebAssembly imports before instantiation, or normalize the runtime instantiation failure.
- Report the missing module/function names through a stable `wavec` diagnostic.
- Explain that modules with custom browser host imports require an explicit JavaScript host runner.
- Preserve successful `wavec run` behavior for modules that need no custom imports.
- Add a regression based on the existing browser-hosted example.
## Acceptance criteria
- No raw Node.js stack or unclassified `LinkError` is shown for missing host imports.
- The diagnostic names `env.host_add` and provides an actionable next step.
- Standalone WebAssembly execution remains covered.
Contributor guide
Research direction
Start with the `wavec run` implementation and reproduce the failure using `examples/wasm_module.wave` for `wasm32-unknown-unknown`. Inspect where WebAssembly imports are instantiated, add a regression for the browser-hosted example, and verify that missing `env.host_add` produces a stable actionable diagnostic while modules without custom imports still run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100