Skip to content

runtime: implement WebAssembly/ESM integration for .wasm imports - #35587

Open
robobun wants to merge 9 commits into
mainfrom
farm/dd4bd17b/wasm-esm-integration
Open

runtime: implement WebAssembly/ESM integration for .wasm imports#35587
robobun wants to merge 9 commits into
mainfrom
farm/dd4bd17b/wasm-esm-integration

transpile_virtual_module: read raw bytes for wasm loader instead of L…

1263c02
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 31m 49s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/runtime/jsc_hooks.rs:4311-4314 is_commonjs_require wasm→file demotion missing from transpile_virtual_module sibling entry

Annotations

Check warning on line 4314 in src/runtime/jsc_hooks.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

is_commonjs_require wasm→file demotion missing from transpile_virtual_module sibling entry

This CJS-only demotion enforces "WebAssembly/ESM integration is ESM-only" for filesystem paths, but the sibling entry `transpile_virtual_module` (jsc_hooks.rs:4601+) has no `is_commonjs_require` parameter — so `require('virtual-add.wasm')` on a `Bun.plugin` `b.module()` reaches the new `SyntheticModuleType::Wasm` branch in `handleVirtualModuleResult` (ModuleLoader.cpp:417-421) via `fetchCommonJSModule` and attempts wasm ESM instantiation through `provideFetch`+`drainSynchronousModuleQueue` inste